Skip to content

fix(coding-agent): await post-compaction continuation - #881

Open
parkerpettit9 wants to merge 1 commit into
fix/acp-prompt-waits-for-idlefrom
fix/acp-post-compaction-continuation
Open

fix(coding-agent): await post-compaction continuation#881
parkerpettit9 wants to merge 1 commit into
fix/acp-prompt-waits-for-idlefrom
fix/acp-post-compaction-continuation

Conversation

@parkerpettit9

@parkerpettit9 parkerpettit9 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

compact.run stops the current agent loop, compacts, then schedules a continuation. That scheduled work was not part of waitForIdle(), so ACP could return a silent end_turn before the continuation started.

Track the scheduled continuation in the session idle contract so headless clients wait for the resumed turn.

Verification:

  • npm run check
  • npx tsx ../../node_modules/vitest/dist/cli.js --run test/suite/acp-mode.test.ts

Note

Fix premature end_turn in ACP mode by awaiting post-compaction continuation

ACP previously returned a silent end_turn before a compaction-triggered continuation had a chance to resume the agent. AgentSession now tracks post-compaction continuation settlement via a promise, and the idle-drain loop awaits it before reporting idle. Cancelling a scheduled continuation also resolves the promise so no waiters hang indefinitely.

Macroscope summarized 01a590f.


Note

Medium Risk
Touches the session idle gate, ACP turn boundaries, and daemon worker relaunch env—incorrect timing could still false-quiesce or strand workers, but changes are heavily tested and client-owned credentials stay out of resident descriptors.

Overview
Fixes headless and ACP clients finishing a turn before compaction-scheduled work runs, by tracking a settlement promise in AgentSession.waitForIdle() so timer-driven post-compaction continuations are part of the idle contract (including cancel/reschedule paths).

ACP now treats session/prompt as admissible only after an extra waitForIdle(), emits quiescence _meta (outstanding subagents + remaining autonomous continuations from a live roster snapshot), hardens session/new against concurrent creation and failed initial snapshots, and adjusts daemon attach so reattachable ACP sessions use resident lifecycle while still forwarding launchEnv for model/proxy credentials.

Daemon supervisor persists launchEnv on resident worker descriptors (not client-owned) and reapplies it on worker relaunch after supervisor restart; tests cover ACP kernel namespace reconnect and resident env recovery.

Reviewed by Cursor Bugbot for commit 01a590f. Bugbot is set up for automated code reviews on this repo. Configure here.

@parkerpettit9
parkerpettit9 force-pushed the fix/acp-post-compaction-continuation branch from 2dcf7a3 to 01a590f Compare August 7, 2026 20:40
@parkerpettit9
parkerpettit9 changed the base branch from main to fix/acp-prompt-waits-for-idle August 7, 2026 20:40
@parkerpettit9
parkerpettit9 marked this pull request as draft August 7, 2026 20:40
@parkerpettit9
parkerpettit9 marked this pull request as ready for review August 7, 2026 20:42
zhengr pushed a commit to zhengr/prime-agent that referenced this pull request Aug 8, 2026
… prompts (PrimeIntellect-ai#881)

* feat(extensions): add inline-bash example for expanding !{command} in prompts

Adds an example extension that expands inline bash commands within user
prompts before sending to the agent. Uses the `input` event to transform
patterns like `!{pwd}` or `!{git status}` into their output.

Preserves existing `!command` whole-line bash behavior.

* docs(extensions): add inline-bash to README

* chore: fix stupid bug
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