Skip to content

fix(agent-core): preserve blocked prompt hook context - #200

Merged
kermanx merged 1 commit into
mainfrom
xtr/user-prompt-hook-context
May 29, 2026
Merged

fix(agent-core): preserve blocked prompt hook context#200
kermanx merged 1 commit into
mainfrom
xtr/user-prompt-hook-context

Conversation

@kermanx

@kermanx kermanx commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. This fixes the prompt hook context regression found while reviewing the UserPromptSubmit block behavior.

Problem

UserPromptSubmit block results should end the current turn without immediately calling the model, but the original prompt and hook result should remain in session history and be available to later model turns. The extra blocked-prompt marker made the context behavior diverge from that model and added a wire record that is no longer needed.

What changed

  • Removed the blocked-prompt context marker and restore path.
  • Kept UserPromptSubmit block prompts and hook results in model projection for subsequent turns.
  • Updated the focused context and turn tests to match the intended behavior.
  • Removed the obsolete Vis wire metadata for the deleted marker record.
  • Added a patch changeset for agent-core and the CLI bundle.

Verification

  • pnpm -C packages/agent-core exec vitest run test/hooks/runner.test.ts test/hooks/engine.test.ts test/agent/context.test.ts test/agent/turn.test.ts
  • pnpm --filter @moonshot-ai/agent-core run typecheck
  • pnpm --filter @moonshot-ai/kimi-code run typecheck
  • pnpm -C apps/vis/server exec vitest run test/lib/wire-reader.test.ts test/lib/context-projector.test.ts
  • pnpm -C apps/vis/web exec vite build
  • git diff --check
  • pnpm --filter @moonshot-ai/vis-web run typecheck currently fails on existing baseline issues unrelated to this change, including raw asset imports from agent-core, existing full_compaction.complete field assumptions, and a pre-existing Uint8Array BlobPart typing issue.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented May 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 66da2fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/agent-core Patch
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

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

@pkg-pr-new

pkg-pr-new Bot commented May 29, 2026

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

commit: 66da2fb

@kermanx
kermanx merged commit 5159af3 into main May 29, 2026
7 checks passed
@kermanx
kermanx deleted the xtr/user-prompt-hook-context branch May 29, 2026 07:12
@github-actions github-actions Bot mentioned this pull request May 29, 2026
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