Generate handoff checkpoints in the active conversation - #60
Open
alosec wants to merge 5 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handoff mode now requests a checkpoint by appending a short instruction to the active conversation, preserving the existing prompt prefix. Pressure is checked before each model call, including after tool results, instead of only at the start of a user turn. The instruction asks for a concise checkpoint at the current safe boundary and bounds generation.
After rotation, retain at most four small dialogue messages within 4,096 serialized characters. Omit oversized messages, tool calls/results, images, and old token usage; the full conversation remains archived. This prevents a small retention target from pulling an entire tool-heavy turn into the new context. Native compaction remains available.
Also make the stale-run timeout configurable within a bounded range while preserving the existing default, so slower local inference can be configured without changing other deployments.
Validation: handoff regression tests, TypeScript compilation, and public-safety checks. Regressions cover exact prefix preservation, pressure from new tool output, bounded retained dialogue, cleared historical usage, original-data preservation, and private checkpoint projection. Live latency validation is still in progress.