Skip to content

feat(agent-core-v2): include the prompt in turn.started for goal continuations - #3077

Open
bj456736 wants to merge 1 commit into
MoonshotAI:mainfrom
bj456736:feat/goal-continuation-turn-prompt
Open

feat(agent-core-v2): include the prompt in turn.started for goal continuations#3077
bj456736 wants to merge 1 commit into
MoonshotAI:mainfrom
bj456736:feat/goal-continuation-turn-prompt

Conversation

@bj456736

Copy link
Copy Markdown
Contributor

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.started event — but turn.started.prompt is gated by isDisplayablePromptOrigin, 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

isDisplayablePromptOrigin now 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.prompt for these turns (verified: handleTurnBegin ignores 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.ts 45/45, goal.test.ts + resume.test.ts 132/132.

No changeset: no CLI-user-visible change (the payload addition only feeds the desktop/web UI).

…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.
@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f002560

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@bj456736

Copy link
Copy Markdown
Contributor Author

@codex review

@pkg-pr-new

pkg-pr-new Bot commented Aug 19, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@f002560
npx https://pkg.pr.new/@moonshot-ai/kimi-code@f002560

commit: f002560

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +45 to +47
// 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant