Skip to content

fix(claude-code-cli): ignore informational follow-up prompts#3415

Open
mastertyko wants to merge 4 commits intogsd-build:mainfrom
mastertyko:fix/3168-claude-followup-prompt-guard
Open

fix(claude-code-cli): ignore informational follow-up prompts#3415
mastertyko wants to merge 4 commits intogsd-build:mainfrom
mastertyko:fix/3168-claude-followup-prompt-guard

Conversation

@mastertyko
Copy link
Copy Markdown
Contributor

TL;DR

What: Stops Claude Code follow-up/result notifications from being treated as user prompts.
Why: Those informational follow-ups were polluting prompt context and could change downstream model behavior unexpectedly.
How: Filter async-job-result and follow-up-only user messages out of the prompt context builder, and lock the behavior with regression coverage.

What

This change teaches the Claude Code CLI stream adapter to ignore informational follow-up messages when it builds prompt history for the model.

Affected areas:

  • src/resources/extensions/claude-code-cli/stream-adapter.ts
  • src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts

Depends on #3414 for the shared async-jobs verifier blocker fix used by this branch.

Why

Closes #3168.

Claude follow-up notifications such as async job result messages are not real user prompts. When they were included in prompt history, they could steer the next model turn with noise that the user never actually said.

How

The stream adapter now treats async_job_result and other follow-up-only user messages as informational, excluding them from the prompt transcript that gets sent back to Claude. Regression tests cover both the ignored follow-up path and the normal user-prompt path.

Change type

  • fix — Bug fix
  • feat — New feature or capability
  • refactor — Code restructuring (no behavior change)
  • test — Adding or updating tests
  • docs — Documentation only
  • chore — Build, CI, or tooling changes

Scope

  • pi-tui — Terminal UI
  • pi-ai — AI/LLM layer
  • pi-agent-core — Agent orchestration
  • pi-coding-agent — Coding agent
  • gsd extension — GSD workflow
  • native — Native bindings
  • ci/build — Workflows, scripts, config

Breaking changes

  • No breaking changes
  • Yes — described above

Test plan

  • CI passes
  • New/updated tests included
  • Manual testing — steps described above
  • No tests needed — explained above

Verified locally with the full CI mirror gate:

  • npm run build
  • npm run typecheck:extensions
  • npm run test:unit
  • npm run test:integration

The final truth phase was re-run in a plain verification clone on the exact branch head after a worktree-specific late verifier stall.

AI disclosure

  • This PR includes AI-assisted code — prepared with Codex and verified as described in the test plan above.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🟡 PR Risk Report — MEDIUM

Files changed 4
Systems affected 1
Overall risk 🟡 MEDIUM

Affected Systems

Risk System
🟡 medium Async Jobs
File Breakdown
Risk File Systems
🟡 src/resources/extensions/async-jobs/job-manager.ts Async Jobs
src/resources/extensions/async-jobs/await-tool.test.ts (unclassified)
src/resources/extensions/claude-code-cli/stream-adapter.ts (unclassified)
src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts (unclassified)

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claude-code-cli: async_bash followUp notifications ingested as user prompts, triggering autonomous turns in interactive mode

1 participant