Skip to content

fix(server): stop Codex turns stuck in a compaction loop (release line) - #126

Merged
nullStack65 merged 3 commits into
release/native-0.1.10from
port/clo-921-release
Nov 20, 2026
Merged

nullStack65 merged 3 commits into
release/native-0.1.10from
port/clo-921-release

Conversation

@nullStack65

@nullStack65 nullStack65 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

The Codex compaction-loop guard (Linear CLO-921) was opened against the stale main in #119, where it gets no CI and does not ship. This PR ports its two commits onto release/native-0.1.10 (Linear CLO-941).

CompactionLoopGuard.ts and its counting tests apply unchanged under orchestration-v2/. main hooked the guard into ProviderRuntimeIngestion, which does not exist on the release line. Here the hook is a small worker built the same way as IdleCompactionService. It watches committed events for finished Codex compactions, and when the loop trips on an active run it sends the existing run.interrupt with the loop message. Manual /compact runs are ignored.

Differences from #119: the stop shows as one interrupt row with the loop message rather than a separate error row, and in-memory history is not cleared when a session exits.

Tests: CompactionLoopGuard.test.ts passes (10). Typecheck for t3 passes. check:changed shows the same knip and AgentContextBudget failures that are already on the base.

Review round (claude-fable-5-2), fixed: compaction history is now kept per provider thread, so Codex subagents that each compact once no longer interrupt their parent turn. The new test fails before the fix and passes after (11 tests). The guard also reuses isCompactionCommandMessage and lets interrupts through.

Deploy: fleet

Model: claude-opus-5-5
Task: CLO-941 port the Codex compaction-loop guard (CLO-921) to the release line

🤖 Generated with Claude Code

Track Codex compactions per thread. Three within five minutes appends a visible error activity and interrupts the active turn without resuming.

(cherry picked from commit 1fd3fae)
Ported-to: release/native-0.1.10 (CLO-941)
Model: claude-opus-5-5
Task: coding
Task: CLO-941 port CLO-921
Agent: T3 Claude Code (CLO-921 lane)
Agent: magpie-port
Lane: magpie
Harness: t3/claude-code
Model-family: Claude
Model-generation: 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A manual /compact tags only the first of Codex's two compaction signals, so the untagged pair was still counting. Three manual compacts, or one manual plus two automatic ones, could stop the turn. That pair is now ignored. A loop that trips while no turn is active keeps its history, so the next compaction on a live turn still stops.

(cherry picked from commit 551fab3)
Ported-to: release/native-0.1.10 (CLO-941)
Model: grok/grok-4.7
Model: claude-opus-5-5
Task: coding
Task: CLO-941 port CLO-921
Agent: T3 Codex (CLO-921 lane)
Agent: magpie-port
Lane: magpie
Harness: t3/claude-code
Model-family: Claude
Model-generation: 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…guard

Codex subagents carry their parent's run, so three subagents that each
compacted once within five minutes interrupted a healthy parent turn. The
guard now keeps history per provider thread, reuses the shared compaction
command check, and lets interrupts through instead of logging them.

Review finding from the CLO-941 port review of the compaction-loop guard (CLO-921).

Model: claude-opus-5-5
Task: CLO-941 port the Codex compaction-loop guard (CLO-921) to the release line
Agent: magpie
Lane: magpie
Harness: t3/claude-code
Model-family: Claude
Model-generation: 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@nullStack65
nullStack65 merged commit 2a86641 into release/native-0.1.10 Nov 20, 2026
4 of 5 checks passed
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.

2 participants