Skip to content

Continue after compact 2 - #262

Merged
mrsimpson merged 2 commits into
mainfrom
continue-after-compact-2
Apr 21, 2026
Merged

mrsimpson merged 2 commits into
mainfrom
continue-after-compact-2

Conversation

@mrsimpson

Copy link
Copy Markdown
Collaborator

No description provided.

…instruction following

- Add 'YOU MUST FOLLOW THESE INSTRUCTIONS' header
- Add IMPORTANT, ACTION REQUIRED, CRITICAL markers to key instructions
- Makes instructions stand out from contextual text in synthetic injection
Two-pronged fix for post-compaction context loss:

1. Enhance experimental.session.compacting hook to inject full phase
   instructions (via WhatsNextHandler) into the compaction summary so
   the AI retains complete workflow context even when chat.message does
   not fire for the synthetic auto-continue message.

2. Fix post-compaction prompt injection by switching from the blocking
   client.session.prompt() to client.session.promptAsync(), which fires
   and forgets (HTTP 204) without blocking the Effect runtime. Add a
   500ms delay to let the runner state machine settle before the
   phase-aware 'Continue with the current phase.' message is sent.

Also adds typed BusEvent discriminated union to types.ts to replace the
previous unknown event type in the event hook signature.
@mrsimpson
mrsimpson merged commit be2a252 into main Apr 21, 2026
3 checks passed
@mrsimpson
mrsimpson deleted the continue-after-compact-2 branch April 21, 2026 11:58
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