feat(agent-core-v2): include the prompt in turn.started for goal continuations - #3077
feat(agent-core-v2): include the prompt in turn.started for goal continuations#3077bj456736 wants to merge 1 commit into
Conversation
…inuations Chat UIs render a goal-continuation prompt as a visible bubble (like a cron fire); the live view builds that bubble from turn.started, which previously omitted the prompt for every system trigger. Keep other system triggers hidden; only goal_continuation becomes displayable. History already carries the prompt on the persisted trigger message, so reloads were unaffected.
|
|
@codex review |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0025602f2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Goal continuations surface as a visible prompt bubble in chat UIs (like a | ||
| // cron fire), so the prompt text must travel with turn.started for the live | ||
| // view to render it — history already carries it on the persisted message. |
There was a problem hiding this comment.
Remove ordinary comments from the comment-free package
When the root pnpm lint runs, scripts/check-no-comments.mjs scans both packages/agent-core-v2/src and test and rejects these ordinary comments; the second newly added comment block at loop.test.ts:802-803 fails for the same reason. Remove both blocks or express the intent through naming.
AGENTS.md reference: packages/agent-core-v2/AGENTS.md:L36-L39
Useful? React with 👍 / 👎.
| // Goal continuations surface as a visible prompt bubble in chat UIs (like a | ||
| // cron fire), so the prompt text must travel with turn.started for the live | ||
| // view to render it — history already carries it on the persisted message. | ||
| if (origin.kind === 'system_trigger') return origin.name === 'goal_continuation'; |
There was a problem hiding this comment.
Prevent goal continuations from becoming searchable user prompts
When an automatic goal continuation occurs in a live session, this makes its long internal model instruction become TurnStarted.prompt; coreEventMap.ts:337-344 stores that as the transcript turn prompt, and searchService.ts:563-577 indexes every such prompt as a user message. Cold indexing deliberately excludes system_trigger messages (wireExtract.ts:72-76), so searches can return internal goal instructions while the session is live and then lose those hits after a cold rebuild. Keep the UI-only continuation text out of the searchable prompt field or filter this origin from live search indexing.
Useful? React with 👍 / 👎.
Why
The chat UI (kimi-code-app) renders a goal-continuation prompt as a visible right-side bubble, like a cron fire (MoonshotAI/kimi-code-app#273). The live view builds that bubble from the
turn.startedevent — butturn.started.promptis gated byisDisplayablePromptOrigin, which hides every system trigger, so live the bubble has no text and the raw prompt only appears after a reload (the persisted trigger message always carried it).What
isDisplayablePromptOriginnow also returns true for{ kind: 'system_trigger', name: 'goal_continuation' }— only goal continuations; every other system trigger (subagent etc.) keeps its prompt hidden.The TUI does not consume
turn.started.promptfor these turns (verified:handleTurnBeginignores it), and the kap-server transcript projection is unchanged, so behavior elsewhere is unaffected.Tests
Updated the loop test that pinned prompt omission: it now asserts goal continuations carry their prompt while other system triggers stay hidden.
loop.test.ts45/45,goal.test.ts+resume.test.ts132/132.No changeset: no CLI-user-visible change (the payload addition only feeds the desktop/web UI).