-
Notifications
You must be signed in to change notification settings - Fork 4
fix: remove machine-initiated context compaction #384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3830,23 +3830,32 @@ export class AgentEngine { | |
| }); | ||
| this.registry.set(agentId, updated); | ||
|
|
||
| if (agent.spawn_depth === 0) { | ||
| // Root agent: send /compact | ||
| const compactRoute = await this.resolveAgentIoRoute(agentId); | ||
| await this.client.send(compactRoute.surface_id, "/compact", { | ||
| workspace: compactRoute.workspace_id ?? undefined, | ||
| ...this.stableSurfaceWriteOptions(compactRoute.surface_uuid), | ||
| }); | ||
| const returnRoute = await this.resolveAgentIoRoute(agentId); | ||
| await this.client.sendKey(returnRoute.surface_id, "return", { | ||
| workspace: returnRoute.workspace_id ?? undefined, | ||
| ...this.stableSurfaceWriteOptions(returnRoute.surface_uuid), | ||
| }); | ||
| } else { | ||
| try { | ||
| await this.client.log( | ||
| `context-limit: depth ${agent.spawn_depth} agent ${agent.repo} degraded; leaving pane running for orchestrator decision`, | ||
| `context-limit: depth ${agent.spawn_depth} agent ${agent.repo} degraded at ${contextPct}%; leaving pane running for orchestrator decision`, | ||
| { level: "warning", source: "cmuxlayer" }, | ||
| ); | ||
| } catch { | ||
| // Logging is advisory; a root-agent nudge must still be attempted. | ||
| } | ||
|
|
||
| if (agent.spawn_depth === 0) { | ||
| const nudgeRoute = await this.resolveAgentIoRoute(agentId); | ||
| await this.client.send( | ||
| nudgeRoute.surface_id, | ||
| `[cmuxlayer] context at ${contextPct}% — checkpoint at-risk work and /compact when safe`, | ||
| { | ||
| workspace: nudgeRoute.workspace_id ?? undefined, | ||
| ...this.stableSurfaceWriteOptions(nudgeRoute.surface_uuid), | ||
| beforeMutation: async () => { | ||
| await this.resolveUnchangedAgentIoRoute( | ||
| agentId, | ||
| nudgeRoute, | ||
| "context-limit nudge", | ||
| ); | ||
|
Comment on lines
+3850
to
+3855
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When AGENTS.md reference: AGENTS.md:L20-L25 Useful? React with 👍 / 👎. |
||
| }, | ||
| }, | ||
| ); | ||
| } | ||
| } | ||
| } catch { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this send or its new stale-route gate throws—for example because the surface moves during the guarded mutation—the surrounding catch suppresses the error after the record has already been persisted as
quality: "degraded". Every later sweep then fails theagent.quality !== "degraded"condition, so the nudge is never attempted on the corrected route; delivery state should be tracked separately or the quality transition rolled back when the nudge was not delivered.Useful? React with 👍 / 👎.