Repository navigation
fix(chat): keep active skill instructions after compaction - #5667
kojiwakayama wants to merge 6 commits into
Conversation
Keep the latest successful load_skill result in prepared history, within the token budget. Masked tool search results now tell the model to search again. Report compacted tool outputs in preparation diagnostics.
📦 Client bundle boundary
A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in |
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34eeed0705
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Keep only the matching load_skill call and result when a turn is compressed. Put the pair back after hosted context compaction when it fits, and report it when it does not. Keep the active skill round in Anthropic requests. Treat repeat-notice text as a repeat only when an earlier full result exists. Fix a type error in the retention tests.
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39e2c34778
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Compact the round that loaded the active skill, but keep its call and result. Drop thinking and parallel calls beside a partial round. Require the result to be next to the call. Check both possible user message groupings in input validation.
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4e70f3f27
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Later requests can now rebuild the same context. The event names the stored call and result messages, and the kept copies are never trusted.



Problem
After a new user message, the model could lose the instructions of the skill it was using. A long
load_skillresult was replaced with[load_skill output omitted (N chars)].Cause
maskOldToolOutputsshortens tool results from earlier turns. It had no rule for the active skill. Only small results (up to 4,096 characters) from the previous turn, and messages in the preserved list, were kept. Turn compression could also remove the skill when the history was over the token budget.Change
load_skillandveryfront__load_skill.prepareProviderModelMessagesFromUiMessagesandcompactForStep.HistoricalToolOutputCompactionDiagnostictype lists masked outputs, and an active skill dropped for budget (active_skill_over_token_budget) or for a reused tool call ID (active_skill_tool_call_conflict). The hosted budget result has a newdroppedActiveSkillfield and a debug log. Hosted execution returns it ashistoricalToolOutputCompactions, and logs it when a context-budget logger is set.Code moves: the activation check moved unchanged to
src/skill/activation-result.ts, and the policy file still exports it. The "already loaded" text now lives there too, so the writer and the reader share it.enforceTokenBudgetWithTurnCompressionhas a new optional fifth parameter, a map. New files:src/skill/active-skill.ts,src/skill/active-skill-context-id.tsandsrc/agent/hosted/active-skill-context.ts.findActiveSkillPromptCalland the typeActiveSkillCallare new exports ofveryfront/provider/shared. The chat API reference was regenerated.Tests
message-prep.test.tsandchat-preparation.test.ts. Some steps fail because the new diagnostics or search marker did not exist yet.src/agent/hostedand the Anthropic extension. Format, lint, typecheck, test typecheck, module boundary, client bundle, size limit and API docs checks passed.Limits
tokensAfteris too low.tokensAfterstill counts it.maxMessages,maxTokens) can still drop the skill.compactForStepcallers do not collect the new diagnostics.Not verified