Skip to content

fix(parent-wake): reuse prompt gate assistant blocking#4288

Open
SpencerJung wants to merge 1 commit into
code-yeongyu:devfrom
SpencerJung:fix/parent-wake-assistant-blocking
Open

fix(parent-wake): reuse prompt gate assistant blocking#4288
SpencerJung wants to merge 1 commit into
code-yeongyu:devfrom
SpencerJung:fix/parent-wake-assistant-blocking

Conversation

@SpencerJung
Copy link
Copy Markdown
Contributor

@SpencerJung SpencerJung commented May 22, 2026

Summary

  • Reuse the shared prompt-async-gate assistant-turn predicate before dispatching parent wake prompts.
  • Prevent parent wakes from injecting while the latest assistant response is still streaming or has finish: unknown.
  • Add regression coverage for stale-idle parent wake dispatch with an unknown/streaming assistant turn.

Changes

  • Export latestAssistantTurnBlocksInternalPrompt from the shared prompt gate.
  • Use it in ParentWakeNotifier instead of the narrower tool-wait-only check.
  • Extend parent-wake race tests for non-tool incomplete assistant turns.

Testing

bun test packages/ast-grep-mcp/src/sg-cli-path.test.ts src/features/background-agent/parent-wake-user-message-race.test.ts src/features/background-agent/parent-wake-active-turn-event.test.ts src/features/background-agent/parent-wake-same-source-requeue.test.ts src/hooks/todo-continuation-enforcer/todo-continuation-enforcer.test.ts src/cli/run/output-renderer.test.ts src/shared/agent-display-names.test.ts
bun run typecheck
bun run build

Related Issues

Refs #4164
Refs #4167
Refs #4169


Summary by cubic

Blocks parent wake prompts when the latest assistant turn is incomplete (tool wait, streaming, or finish: unknown) by reusing the shared prompt gate predicate. Fixes a race that injected parent wakes while an assistant response was still in progress (refs #4164, #4167, #4169).

  • Bug Fixes
    • Exported and reused latestAssistantTurnBlocksInternalPrompt in ParentWakeNotifier (replaces tool-wait-only check).
    • Updated log message to reflect generic “blocks internal prompts” state.
    • Added tests for unknown/streaming assistant finishes and extended parent-wake race coverage.

Written for commit f217603. Summary will update on new commits. Review in cubic

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: This change replaces a tool-wait-only check with the same shared predicate already used in the prompt gate, adding a test for the missing streaming/unknown finish case, so the logic is strictly more correct and cannot introduce regressions.

Re-trigger cubic

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