Repository navigation
feat: Codex compactions become compaction spans (RIUS-1547) - #68
Conversation
…all is flagged (RIUS-1547) A compacted rollout line is a compaction span (kind summarize, executor client or provider, sizes before and after, window id, summary bytes and gated text). The first real model call after it carries gen_ai.conversation.compacted. The format is from Codex source: no real compaction was captured.
factory/review: CHANGES (round 1) @ d0a2811The structure is sound. The span is sent at the line and re-sent under the same id once the size after is known, the same pattern as PR 67. The summary text is re-read from the rollout behind the capture gate, so it never sits in the state file. The local estimate Verified
FindingsF1 (P2, blocking):
F2 (P3): the fixture and docs say the remote compaction has no estimate after it. F3 (P3): test gaps, 3 surviving mutants.
F4 (P3, note): with two F5 (P3):
F6 (P3, note): Also noted, not a finding: Sonnet challenger: it confirmed F1-F4, raised F5 (verified in the source above) and F6, and found no flag or settle bug. Not verified
|
… empty, and review fixes (RIUS-1547) Both Codex writers set compaction_response_id, so it cannot tell a local compaction from a remote one: the empty message can. A compaction that follows an unsettled one has no size before of its own. Tests pin the same-millisecond estimate, the estimate as the next size before, and the window learned after the line.
factory/review: PASS (round 2) @ 41deddaRe-review of the one commit on top of round 1 (d0a2811). It touches Earlier findings
Verified
FindingsNone new. F6 remains an open P3 note. Not verified
|
Ticket: RIUS-1547 (M3). Follows rius-coding-agents #67, the Claude Code half.
What changed
compactedline becomes acompactionCHAIN span under the open turn: kindsummarize, executorproviderwhen the line's message is empty, elseclient(A42; see round 1 below),tokens.before,tokens.after,tokens.dropped,context_window,id=window_id,summary.bytes. Trigger is left unset (the plugin registers no Codex hooks).gen_ai.conversation.compacted = true, and no other. Codex's own estimatetoken_countafter a local compaction (0 input, 0 output) is no call, takes no flag, and givestokens.after.docs/codex.md(Compactions section), pointer indocs/how-it-works.md.Real compaction: NOT checked
The format comes from Codex source (
rollout_payload.rs,protocol.rs), not a captured file. No local Codex rollout holds a compaction, and a real one needs real credentials and the real~/.codex, so it was not run. Per the ticket, the releaser keeps this change out of the plugin release PR until a real check is recorded. Known uncertainties, also in the docs: whether a summarizer call's owntoken_countcan land after thecompactedline is inferred.Checks (head d0a2811)
/usr/bin/python3 -m pytest -q tests/test_codex_spans.py tests/test_codex_export.py tests/test_codex_compaction.py: 103 passed, 1 skippedfactory-heavy 900 /usr/bin/python3 -m pytest -q: 1854 passed, 9 skippedcompact_nextreset,before >= after(new boundary test added for it),_estimate().Challenger waiver (P2, codex_spans.py:347)
Codex asked to keep every pending compaction until its size arrives. Waived on purpose: when a second
compactedline comes before anytoken_count, the size after the first is never observed (the next count measures what the second left), so giving it to the first span would be a wrong number. The first keeps what it was sent with (notokens.after), pinned bytest_a_newer_compaction_takes_the_size_after_not_the_older_one.Assumptions
None new. A37 (flag on the first LLM span only) applies here too.
Round 1 (reviewer: changes) - fixed in 41dedda
executorno longer readscompaction_response_id, which Codex 0.162.1 sets for local and remote compactions alike. It isproviderwhen the message is empty (remote v2),clientwhen it holds summary text. Fixture: local line carries a response id, remote line has an empty message. Rule change recorded as assumption A42.tokens.before, same-millisecond estimate, window learned after the line). All killed.tokens.before.context_tokens,<vs<=, window fill: 5 of 5 killed. Full suite 1860 passed, 9 skipped.