Repository navigation
fix(codex): store every replacement-only compaction value once - #5660
Conversation
|
You have reached your Codex usage limits for security reviews. Please try again later. |
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93211c77cb
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f44002f1dc
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 494293e47f
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f9fa2d6ea
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1ffb4e14f
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
d1ffb4e to
56fdd0a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56fdd0a00b
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Replacement-history text the session holds nowhere else was replaced by a digest-only omission event above 256K characters per value, 512 distinct values or 4 MiB per session, so that content was absent from the archive. Each distinct replacement-only value is now stored once as its own context event, whatever its size or count; values the session already retains are still dropped by the conservation pass, which is what prevents duplication. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
Every distinct replacement-only value is now registered, counted and resolved in the parse's SQLite scratch index, and its context row waits there too; the events are spliced into the event sink from a streaming cursor. A 200,000-value compaction stays within twice the input record's own traced size instead of holding every candidate in a Python dict. The prepared SQLite sinks now store a lone surrogate as a \uXXXX escape and decode such rows with the stdlib decoder, so provider text carrying one no longer fails the insert. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
Replacement contexts are spliced into the event sink with one renumbering pass (SqliteSessionEventSink.insert_sorted), not one tail shift per context. The archive writer's JSON columns keep a lone surrogate as a \uXXXX escape instead of U+FFFD, so stored payloads equal the hashed values. The prepared sink recognizes only real surrogate escapes and decodes them in JSON mode, so literal "\ud800" text and hex digest fields round-trip unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
… projections readable The batched event insertion now shifts existing events by one seek into a table of cumulative insertions per index instead of a correlated count per event. Generated tool columns project a string holding a lone surrogate escape in its escaped spelling, so reading an action no longer fails to decode while the JSON column stays the exact authority. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
…nk coordinates The surrogate-safe tool_command/tool_path projection kept the raw JSON spelling, so quotes, newlines and backslashes stayed escaped next to a lone surrogate. It now decodes the short escapes in SQL and leaves only the surrogate escaped. The sink's surrogate decode round-tripped through model_dump, which drops exclude=True parser coordinates; they are carried over so the writer can still resolve parents and boundaries. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
Answers the Codex review round on d1ffb4e: - The surrogate-safe tool_command/tool_path projection no longer hand-decodes a subset of escapes around a U+FFFF placeholder. It respells escaped backslashes as \, gives each lone-surrogate escape an escaped backslash, and lets json_extract decode the rest: \u00XX controls decode, a real U+FFFF survives, and surrogates stay spelled out. - finish_replacement_contexts iterates the per-compaction count cursor instead of fetchall(). - test: exercise the sink's JSON-mode decode through ParsedMessage, the model _from_text_json is typed for (mypy). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01P8nGdByCWAzpk78ko2xza6
…jection The session timeline extracted payload_json.summary/text with bare json_extract, which fails with "Could not decode to UTF-8" once a stored payload keeps a lone-surrogate escape. It now uses the same projection as the tool columns, which keeps the surrogate spelled out and decodes every other escape. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01P8nGdByCWAzpk78ko2xza6
56fdd0a to
d27956d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d27956db38
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…urrogate-safe Building one nested ``replace`` per surrogate prefix (32 of them) overflowed older SQLite's (3.45) parser stack and made the generated columns uncreatable; three flat calls matching \uD rather than each \uD800-\uDFFF prefix are exact for this archive's JSON, since _json_dumps only ever escapes a lone surrogate. The delegation dispatch projection's ``requested_model`` read raw json_extract and so shared the same failure a subagent's stored model name could hit; it now goes through the same surrogate-safe projection the tool identity columns use. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cdc132858c
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…fallback Replacement and task-completion candidates now hold their text once in the scratch index, keyed everywhere else by a SHA-256 digest that every lookup confirms against the stored text. The legacy execution-command fallback reads cmd and arguments through the surrogate-safe projection. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09a193d9e6
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ations surrogate-safe Delegation instruction predicates read through the surrogate-safe projection; the deferred asserted branch point is read in its JSON spelling and bound through the stored native-id substitution; Codex replacement annotations are held pickled in scratch. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2b55f53c8
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The candidate key is the SHA-256 of the text's exact code points, hashed in bounded windows, so no second full-size encoding is built and a match is decided by the key alone without unpickling the stored text. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c59a7d7b6e
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d6012f568
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…racter Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4890b33cb8
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…-context # Conflicts: # polylogue/sources/prepared_message_sink.py
The NFC lookup key of a replacement or task candidate is hashed from a streaming normalization, so no second full-size copy is built. Provider bytes decode through one shared helper that keeps lone surrogates and joins CESU-8 pairs, used by the raw decoder, the streamed JSONL decoder and core.json's stdlib fallback. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1569459de1
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1648f2c6fa
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…-context # Conflicts: # polylogue/sources/prepared_message_sink.py # tests/unit/sources/test_prepared_jsonl.py
…tection Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 387574d69d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…-context # Conflicts: # polylogue/archive/raw_payload/decode.py
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c8cb9387e
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 687fb87336
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8713f24ed1
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…-context # Conflicts: # polylogue/sources/decoder_json.py # polylogue/sources/prepared_message_sink.py
…w copies Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…-context # Conflicts: # polylogue/sources/prepared_message_sink.py # tests/unit/sources/test_prepared_jsonl.py
…-context # Conflicts: # polylogue/storage/sqlite/archive_tiers/write.py # tests/unit/storage/test_lineage_normalization.py
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…-context # Conflicts: # polylogue/operations/session_reads.py # polylogue/storage/sqlite/archive_tiers/write.py
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…ity2 Master added a FAILED outcome at the post-publication requiredness recheck. Like every other exception-backed FAILED outcome in this branch, it now names the exception type first and carries transient=_is_transient_failure(exc), with a test. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Summary
Problem
Solution
_CodexTextConservationstores each distinct replacement-only value once, with an occurrence count, and drops values retained elsewhere._nfc_text_digesthashes the NFC form in windows._SpilledMarkRunbuckets an overlong combining run by canonical combining class on disk, which is the stable canonical sort, and composes each bucket's prefix.core.json.decode_provider_utf8decodes once through the registered error handlerpolylogue-provider-surrogates. It pairs CESU-8 and keeps lone code units, and skips a UTF-8 BOM through a memoryview.loads()retries the original bytes when the provider decode's text does not parse (BOM-less UTF-16 holdingED A0 80).\uXXXXescapes. A row carrying one is parsed once by the stdlib and validated in Python mode; theSINK_JSON_CONTEXTflag keeps JSON-mode field parsing such as paste-digest hex._parse_stringconsumes plain runs and pairs surrogates as they are pushed.combine_surrogate_pairsis deleted.render_semantic_transcript_markdownandrender_semantic_cards_markdownescape lone surrogates at the output boundary.Schema classification: derived-identity closure only (
sources/parsers/codex.py,sources/origin_specs.py), no DDL. It lands before the fresh build.Verification
agentctl … verify_quickon 85b6e16: Success.agentctl … pytest_focused -- tests/unit/sources/test_parsers_codex.py tests/unit/sources/test_prepared_jsonl.py tests/unit/sources/test_codex_whale_fixtures.py tests/unit/sources/test_codex_compaction_and_turn_context.py tests/unit/rendering/test_semantic_card_web_cli_parity.py tests/unit/core/test_tool_identity.py(job 2023): Success.Self-review
Merge resolutions with master, checked separately:
_json_dumpskeeps master's type lowering from fix: Codex P2 review debt: polylogue/daemon part 5 (6 findings) #5728 (sets, enums, Decimal, bytes, datetimes, now_json_value) while keeping strings exact, then escapes lone surrogates.test_spec_owned_row_plumbingandtest_store_opspass (job 2278)._EVENT_SUMMARY_SQL,_EVENT_TEXT_ONLY_SQL)._ScratchChatGPTEntries.ordered) now decodes through_from_text_json, so a lone surrogate does not break it.test_search_read_timeline_and_mcp_use_ownerfails identically on master (polylogue-zeolc). The three provider-usage lineage tests are polylogue-ezvw3.I read the complete diff against master and every review thread. Findings and checks:
ParsedPasteEvidence.content_hashhex), and the context flag covers it. Excluded parser coordinates are validated from the stored payload, so the removed carry-over is not needed. Covered by the existing hex and coordinate tests plus the new no-dump test.$not followed by{is literal, and${still refuses.unicodedata.normalizeexactly. A starter left with no marks after it returns to the unsettled text, so it can still compose.json.dumpsescapes them.🤖 Generated with Claude Code
https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg