fix(story-mode): a helper reporting back is heard in its own words

From review round 9: a background job's page showed only Claude Code's
line 'Agent "Helper B: write extra pytest tests" finished', so what the
helper said about its own work vanished, here that it had never run its
tests against the real wordcount.py.

The notice balloon now carries the helper's report like Claude's last
words (its first sentence and the key sentences from the rest):
'"Helper B: write extra pytest tests" reports: I wrote the file:
tests/test_extra.py It has 18 test cases … I haven't run it against the
real wordcount.py.' A report that is only a path is its file name, and
absolute paths keep their last two parts, so a long path does not push
the sentence that matters out of a phone's balloon.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-18 16:47:23 +02:00
1 parent 226a7bbbd8
commit 2ec74273f0
6 files changed
+36 -6

No files matched your search

+20
View File
@@ -2376,6 +2376,26 @@ function decorate(draft: DraftPanel, events: StoryEvent[], turn: StoryTurn, inde
: lines[origin];
// Words that started the turn but are not yours are a note, not your balloon.
if (panel.balloon && !command && origin !== 'human') panel.balloon = { ...panel.balloon, who: 'note' };
// A helper reporting back: its own words, not only the line saying it finished, so what it
// did not do ("I haven't run them against the real file") is on the page.
const report = origin === 'task' && evs[0]?.helper?.result?.trim();
if (panel.balloon && report) {
// A report that is only a path says which file it wrote: its name is enough.
const said = (
/^\S+$/.test(report) && report.includes('/') ? basename(report) : closingText(report, keyPointsOf(report))
)
// An absolute path is mostly room: its last two parts ("tests/test_extra.py") say which file.
// Run on the clipped balloon (560 characters at most), so the scan stays short.
.replace(/(?<![\w.~-])\/(?:[^\s/]+\/)+([^\s/]+\/[^\s/]+)/g, '$1');
const name = /^Agent "(.+)" (?:finished|completed)\.?$/.exec(panel.balloon.text)?.[1];
if (said)
panel.balloon = {
who: 'note',
text: name
? `"${name}" reports: ${said}`
: `${panel.balloon.text.replace(/[.]?$/, '.')} Its report: ${said}`,
};
}
director = command
? `Command · ${clip(evs[0].label, 60)}`
: `Prompt · ${plural(words, 'word')}${origin === 'human' ? '' : ` · ${origin}`}`;