Repository navigation
fix(storage): close the append-ingest gate + declare the missed workflow-artifact reparse - #3433
Conversation
…check Problem: PR #3428 unified two of the three chokepoints that can turn a raw record into a session (live daemon ingest and rebuild replay) behind classify_artifact/artifact_rule_for_path, but left the third -- live incremental append (sources/live/append_ingest.py) -- untouched: it called parse_payload unconditionally, with no session-artifact gate at all. Empirically verified (polylogue-xwkh): a growing OriginSpec-declared "fact" artifact (e.g. subagents/workflows/<run>/journal.jsonl, parse_policy="fact") that reaches append tracking -- e.g. after an ops.db cursor reset resynthesizes a cursor from a durable "full" baseline already recorded in source.db, see batch.py's _resynthesize_cursor_from_source -- was NOT leaking a phantom session, but only by accident: parse_retained_raw_sessions (used later for replay) already applies the same gate and returns zero sessions, which trips the "did not replay to exactly one session" RuntimeError. That still meant a wasted raw write, a wasted parse, and a crash-shaped failure log on every single observation of the file, forever, since a failed append never advances its cursor. Solution: import revision_backfill._is_declared_non_session_artifact (the same check the other two chokepoints already consult) and apply it to the append's decoded record sample before calling parse_payload. A refused record now fails cleanly (mark_raw_parse_failed + failed.append) instead of via an uncaught-looking RuntimeError, and does no wasted parse work. Verification: devtools test tests/unit/storage/test_raw_revision_authority.py -k test_live_append -- 3 passed (new test_live_append_refuses_declared_non_session_artifact plus the two existing live-append regression tests, confirming real Codex session appends are unaffected). Ref polylogue-xwkh Co-Authored-By: Claude <[email protected]>
Problem: PR #3088 (1e0246d, merged 2026-07-18) fixed Claude Workflow artifact classification (workflow_run_snapshot / workflow_journal / agent_sidecar_meta / adopt_manifest now correctly resolve parse_policy="fact"/parse_as_session=False) but declared no INDEX_SCHEMA_VERSION delta. Per docs/internals.md's schema-versioning model, only a declared SEMANTIC_REPARSE delta gives the daemon a signal to reparse; an undeclared semantic change leaves already-materialized wrong- classification rows untouched forever, because fast-forward convergence has no version transition to act on. Measured live impact (index.db, read-only, 2026-07-31): 172 zero-message claude-code-session rows (164 agent_sidecar_meta + 7 workflow_run_snapshot + 1 other) acquired 2026-07-14..07-26, entirely before the deployed daemon build picked up the fix (sinnix's polylogue pin advanced past 1e0246d only on 2026-07-29). Solution: bump INDEX_SCHEMA_VERSION to 48 (archive_tiers/index.py) and add its IndexDeltaDeclaration (storage/sqlite/lifecycle.py) with classes=(SEMANTIC_REPARSE,) and no fast-forward operations -- the same "values depend on parser semantics, no clone-safe SQL delta" shape as v42/ v44/v45/v46. This does NOT run any rebuild. The operator must run `polylogue ops reset --index && polylogued run` deliberately to apply it; see the PR body for that instruction. Verification: devtools lab policy schema-versioning -> "Schema evolution policy intact." devtools test tests/unit/storage/test_index_fast_forward_lifecycle.py tests/unit/storage/test_index_fast_forward_executor.py tests/unit/devtools/test_archive_schema_fast_forward.py tests/unit/storage/test_schema_policy_contracts.py -- 53 passed. Ref polylogue-lzh8 Co-Authored-By: Claude <[email protected]>
Ref polylogue-xwkh, polylogue-lzh8, polylogue-qs4b Co-Authored-By: Claude <[email protected]>
|
Warning Review limit reached
Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
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. Comment |
# Conflicts: # .beads/issues.jsonl
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54c8b5116e
ℹ️ 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".
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Two related aggz-invariant-2 follow-ups ("exactly one chokepoint may write a
session"):
whether a raw record becomes a session. PR fix(sources): require positive conversation evidence before session classification #3428 unified live daemon
ingest and rebuild replay behind
classify_artifact/artifact_rule_for_path; live incremental append(
sources/live/append_ingest.py) had no such gate at all.SEMANTIC_REPARSEindex-versionbump for PR feat(sources): admit Claude Workflow artifacts through OriginSpec #3088 (1e0246d), which shipped a classification fix for
Claude Workflow artifacts with no version declaration, so already-
materialized wrong rows never got a reparse signal.
Also investigates (per polylogue-xwkh/lzh8's own framing) why
devtools lab policy schema-versioningdidn't stop #3088's undeclared bump,and files a follow-up bead rather than rushing a fix.
Problem
xwkh:
_ingest_append_plans_archivecalledparse_payloadon everyappend unconditionally. Empirically verified (fresh in-memory archive,
ingest_append_planscalled directly) that a growing OriginSpec-declared"fact" artifact (
subagents/workflows/<run>/journal.jsonl,parse_policy="fact") reaching append tracking — e.g. after an ops.dbcursor reset resynthesizes a cursor from a durable
fullbaseline alreadyrecorded in source.db (
batch.py's_resynthesize_cursor_from_source,which consults only byte-provenance, never classification) — did not
leak a phantom session, but only by accident:
parse_retained_raw_sessions(used later, for replay) already applies the same gate and returns zero
sessions, tripping the
did not replay to exactly one sessionRuntimeError. That still meant a wasted raw write, a wasted parse, and acrash-shaped failure log on every single observation of the file,
forever, since a failed append never advances its cursor.
lzh8: measured live impact on
index.db(read-only query,/realm/db/polylogue/index.db, 2026-07-31): 5,193 zero-messageclaude-code-sessionrows total, of which 172 join to aworkflows/artifact family under the pre-fix classification (164
agent_sidecar_meta,7
workflow_run_snapshot, 1 other), all acquired 2026-07-14..07-26 —entirely before the deployed daemon build contained 1e0246d (sinnix's
polylogue pin only advanced past it 2026-07-29).
Lint gap:
devtools/verify_schema_upgrade_lane.py'sindex_delta_declaration_report(INDEX_SCHEMA_VERSION)only checks that thedeclaration table is internally complete/consistent up to the current
INDEX_SCHEMA_VERSIONconstant. It never inspectsorigin_specs.py,artifact_taxonomy/, or any other classification source — a commit thatchanges classification semantics without touching the version constant is
invisible to it by construction. It can only catch an undeclared bump,
never a missing bump. A real fix (content-fingerprinting the
classification tables, versioned and diffed at lint time) is a genuine
architecture addition, not a small local patch, so filed as follow-up
polylogue-qs4b instead of rushed here.
Solution
polylogue/sources/live/append_ingest.py: importrevision_backfill._is_declared_non_session_artifact(the same check theother two chokepoints already consult) and apply it to the append's
decoded record sample (
sample=payloads[:64], same bound as the livedaemon path) before calling
parse_payload. A refused record now failscleanly (
mark_raw_parse_failed+failed.append) instead of via anuncaught-looking
RuntimeError, with no wasted parse work.polylogue/storage/sqlite/archive_tiers/index.py: bumpINDEX_SCHEMA_VERSIONto 48, with a header comment citing 1e0246d/feat(sources): admit Claude Workflow artifacts through OriginSpec #3088and the measured counts.
polylogue/storage/sqlite/lifecycle.py: add the matchingIndexDeltaDeclaration(version=48, classes=(SEMANTIC_REPARSE,))— nofast-forward operations, same "values depend on parser semantics, no
clone-safe SQL delta" shape as v42/v44/v45/v46. This commit does not run
any rebuild.
.beads/issues.jsonl: close polylogue-xwkh, polylogue-lzh8; filepolylogue-qs4b for the lint-gap follow-up.
Operator action required
This PR declares the delta; it does not apply it. To reclassify the 172
contaminated rows, the operator must deliberately run:
against the live archive. This was intentionally not run from this
branch/session per polylogue-lzh8's explicit instruction (consequential
live-daemon action, extended downtime rebuilding ~20K sessions, needs
deliberate scheduling).
AC disposition
polylogue-xwkh (no formal AC list, task framed as investigate+verify+fix+test):
test_live_append_refuses_declared_non_session_artifact).polylogue-lzh8:
lifecycle.pygets a newIndexDeltaDeclarationbumpingINDEX_SCHEMA_VERSIONwithclasses=(SEMANTIC_REPARSE,), comment naming 1e0246d/feat(sources): admit Claude Workflow artifacts through OriginSpec #3088 and the measured counts — satisfied.devtools lab policy schema-versioningstays green — satisfied.Verification
devtools test tests/unit/storage/test_raw_revision_authority.py -k test_live_append→ 3 passed.devtools lab policy schema-versioning→ "Schema evolution policy intact."devtools test tests/unit/storage/test_index_fast_forward_lifecycle.py tests/unit/storage/test_index_fast_forward_executor.py tests/unit/devtools/test_archive_schema_fast_forward.py tests/unit/storage/test_schema_policy_contracts.py→ 53 passed.devtools verify --quick→ exit 0 (format, lint, mypy --strict, render all --check, schema-versioning lint, schema promotion audit) — ran twice (pre-commit local + pre-push hook).devtools verify --all(full non-integration suite) — left for CI's post-merge heavytestjob per this repo's per-PR test-skip convention; not run against the live archive (read-only queries only, no writes, no daemon run).Ref polylogue-xwkh, polylogue-lzh8, polylogue-qs4b
🤖 Generated with Claude Code