Repository navigation
fix(sources): refuse session classification for self-generated analysis artifacts - #3426
Conversation
…is artifacts
Problem: a self-generated analysis index (an agent-written JSONL pointing at
prior conversations by id, e.g. .../analysis/problem_solutions/problems_
index.jsonl) was ingested as a claude-code-session with zero messages. The
recursive source walk already skips directories literally named "analysis"
(source_walk._SKIP_DIRS), but that skip only guards the treewalk-discovery
route; classify_artifact_path had no equivalent path-only exclusion, so a
file admitted through any other acquisition route (or predating the walk
skip at that mtime) falls through to payload-shape heuristics. The generic
looks_like_record_entry heuristic then misreads each {"conversation": <id>,
"type": ...} pointer record as session content, purely because "type" is a
generic recordish key -- exactly the "unrecognised record defaults to a
session" defect described in polylogue-9ykn.
Solution: classify_artifact_path now refuses any path with an "analysis/"
directory segment as a non-session METADATA_DOCUMENT, mirroring
source_walk._SKIP_DIRS's intent at the taxonomy layer so the exclusion holds
regardless of which acquisition route admits the file. Added a regression
test using the observed payload/path shape.
Ref polylogue-omsw, polylogue-9ykn.
Verification: devtools test tests/unit/sources/test_artifact_taxonomy.py
tests/unit/sources/test_assembly_claude_code_history.py -- 18 passed.
…closure Investigation of the reported Claude Code Workflow normalize/session contradiction (2qx.2, z9gh.4, z9gh.6, omsw). Findings: - polylogue-2qx.2 and polylogue-z9gh.4 are accurately closed: direct index.db queries confirm the OriginSpec artifact rules and Workflow materializer are live and correct (7 runs, 122 calls, 164 attempts, 128 results in work_evidence_nodes; the wf_54d4fb2e-841 fixture reproduces its exact declared counts of 91 attempts/50 calls/65 results). - polylogue-z9gh.6 is only partially accurate: its SidecarData-level coverage struct (orchestration_coverage/orchestration_parse_gaps) is computed and discarded every ingest pass, never consumed by any readiness/repair surface, so AC1 and AC5 are not met as claimed. Added a corrective note and filed polylogue-uh9l for the remaining scope. - The live archive's 172 zero-message sessions under the workflow artifact family are stale pre-fix ingestion (acquired 2026-07-14..26, before the deployed daemon build picked up PR #3088 on 2026-07-29), not a currently active classification defect. Filed polylogue-lzh8 to declare the missing SEMANTIC_REPARSE index-version bump PR #3088 never got, which is what actually blocks self-healing. - Updated polylogue-omsw with the narrowed evidence: its journal.jsonl slice is covered by lzh8/the reparse gap, its tool-results/toolu_*.json slice remains the live, still-active gap. No repair executed against the live archive; both filed beads describe and scope the remediation for explicit operator scheduling.
|
Warning Review limit reached
Next review available in: 49 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 (3)
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 |
💡 Codex ReviewWhen a configured source root or any ancestor is named https://github.com/Sinity/polylogue/blob/6fc19b01a1313bd9a976fb3ad7f46423cebf0a2f/.beads/issues.jsonl#L37 This row replaces AGENTS.md reference: AGENTS.md:L267-L270 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
# Conflicts: # .beads/issues.jsonl # tests/unit/sources/test_artifact_taxonomy.py
Problem: polylogue-21qj found 6 non-transcript files under watched ~/.claude/projects trees (a sinex analysis-index, a tool-result spill file x3, a workflow journal, a derived duplicate-messages index) had been ingested as claude-code-session rows. Investigation found 5 of the 6 shapes are already refused at detection time by prior work (#3426, #3428, c6190d7, and the pre-existing workflow_journal OriginArtifactRule) -- verified live by rerunning each real file's exact byte content (read from source.db + the blob store, since 2 of 3 sinex files no longer exist on disk) through classify_artifact/detect_provider_evidence. For cleanup, polylogue-ne6k had already built the classifier+dry-run-gated maintenance-repair pattern this bead asked for (repair.py's `empty_sessions` target, wired through `polylogue maintenance repair --target empty_sessions`) -- but scoped to literally message-less sessions (`NOT EXISTS messages`). claude-code-session:conversation_relationships has 96,748 MESSAGE ROWS, every one carrying zero blocks/words, so it fell outside that predicate entirely and was never even a repair candidate. Solution: widen `_empty_session_candidate_ids` (renamed from `_empty_session_message_less_candidates`) to also propose sessions where `sessions.word_count = 0` regardless of message_count. The existing positive-classification gate (`_raw_artifact_positively_fails_classification`) remains the sole deletion authority, so a legitimate all-tool-use session with no text turns is still retained (its raw artifact still carries real Claude Code envelope markers and passes classification). Also added the one missing regression pin: analysis/signal/high_value_ messages.jsonl (the 6th named shape) was already refused via the analysis/ directory heuristic but had no dedicated test using its real field shape (file/timestamp/type/content). That session is deliberately excluded from the empty_sessions purge (word_count=827,894, real content) -- investigation found its real source session is stuck revision_authority='quarantined' and never parsed, so it is currently the archive's only queryable copy of that conversation; deferred to polylogue-6bebe rather than deciding blanket deletion here. Verification: - devtools test tests/unit/storage/test_empty_session_repair_provenance.py tests/unit/sources/test_artifact_taxonomy.py -- 15 passed. New tests pin both the widened-predicate debris case and its "legit all-tool-use" sibling that must NOT be swept in, plus the high_value_messages shape. - devtools verify --quick -- exit 0, all 19 steps green. - Read-only measurement against the live archive (/realm/db/polylogue): before this change, conversation_relationships was absent from `_empty_session_debris_session_ids`'s output; after, it is flagged alongside problems_index/journal/3x toolu_*. Total flagged debris across the archive went from 5023 to 5076 rows (+53, this generalization also catches other same-shaped phantoms, not only the 5 named here). - Pre-existing, unrelated failure noted and NOT fixed here: tests/unit/ maintenance/test_planner_contract.py and test_planner_filter_narrowing.py fail with a TypeError (row_factory not set on a test fixture's index connection) on master (120cf6f) before this change too (confirmed via git stash) -- filed as polylogue-9rdky. Ref polylogue-21qj, polylogue-gvgi (closed as duplicate), polylogue-6bebe, polylogue-9rdky Co-Authored-By: Claude <[email protected]>
Problem: polylogue-21qj found 6 non-transcript files under watched ~/.claude/projects trees (a sinex analysis-index, a tool-result spill file x3, a workflow journal, a derived duplicate-messages index) had been ingested as claude-code-session rows. Investigation found 5 of the 6 shapes are already refused at detection time by prior work (#3426, #3428, c6190d7, and the pre-existing workflow_journal OriginArtifactRule) -- verified live by rerunning each real file's exact byte content (read from source.db + the blob store, since 2 of 3 sinex files no longer exist on disk) through classify_artifact/detect_provider_evidence. For cleanup, polylogue-ne6k had already built the classifier+dry-run-gated maintenance-repair pattern this bead asked for (repair.py's `empty_sessions` target, wired through `polylogue maintenance repair --target empty_sessions`) -- but scoped to literally message-less sessions (`NOT EXISTS messages`). claude-code-session:conversation_relationships has 96,748 MESSAGE ROWS, every one carrying zero blocks/words, so it fell outside that predicate entirely and was never even a repair candidate. Solution: widen `_empty_session_candidate_ids` (renamed from `_empty_session_message_less_candidates`) to also propose sessions where `sessions.word_count = 0` regardless of message_count. The existing positive-classification gate (`_raw_artifact_positively_fails_classification`) remains the sole deletion authority, so a legitimate all-tool-use session with no text turns is still retained (its raw artifact still carries real Claude Code envelope markers and passes classification). Also added the one missing regression pin: analysis/signal/high_value_ messages.jsonl (the 6th named shape) was already refused via the analysis/ directory heuristic but had no dedicated test using its real field shape (file/timestamp/type/content). That session is deliberately excluded from the empty_sessions purge (word_count=827,894, real content) -- investigation found its real source session is stuck revision_authority='quarantined' and never parsed, so it is currently the archive's only queryable copy of that conversation; deferred to polylogue-6bebe rather than deciding blanket deletion here. Verification: - devtools test tests/unit/storage/test_empty_session_repair_provenance.py tests/unit/sources/test_artifact_taxonomy.py -- 15 passed. New tests pin both the widened-predicate debris case and its "legit all-tool-use" sibling that must NOT be swept in, plus the high_value_messages shape. - devtools verify --quick -- exit 0, all 19 steps green. - Read-only measurement against the live archive (/realm/db/polylogue): before this change, conversation_relationships was absent from `_empty_session_debris_session_ids`'s output; after, it is flagged alongside problems_index/journal/3x toolu_*. Total flagged debris across the archive went from 5023 to 5076 rows (+53, this generalization also catches other same-shaped phantoms, not only the 5 named here). - Pre-existing, unrelated failure noted and NOT fixed here: tests/unit/ maintenance/test_planner_contract.py and test_planner_filter_narrowing.py fail with a TypeError (row_factory not set on a test fixture's index connection) on master (120cf6f) before this change too (confirmed via git stash) -- filed as polylogue-9rdky. Ref polylogue-21qj, polylogue-gvgi (closed as duplicate), polylogue-6bebe, polylogue-9rdky Co-Authored-By: Claude <[email protected]>
Problem: polylogue-21qj found 6 non-transcript files under watched ~/.claude/projects trees (a sinex analysis-index, a tool-result spill file x3, a workflow journal, a derived duplicate-messages index) had been ingested as claude-code-session rows. Investigation found 5 of the 6 shapes are already refused at detection time by prior work (#3426, #3428, c6190d7, and the pre-existing workflow_journal OriginArtifactRule) -- verified live by rerunning each real file's exact byte content (read from source.db + the blob store, since 2 of 3 sinex files no longer exist on disk) through classify_artifact/detect_provider_evidence. For cleanup, polylogue-ne6k had already built the classifier+dry-run-gated maintenance-repair pattern this bead asked for (repair.py's `empty_sessions` target, wired through `polylogue maintenance repair --target empty_sessions`) -- but scoped to literally message-less sessions (`NOT EXISTS messages`). claude-code-session:conversation_relationships has 96,748 MESSAGE ROWS, every one carrying zero blocks/words, so it fell outside that predicate entirely and was never even a repair candidate. Solution: widen `_empty_session_candidate_ids` (renamed from `_empty_session_message_less_candidates`) to also propose sessions where `sessions.word_count = 0` regardless of message_count. The existing positive-classification gate (`_raw_artifact_positively_fails_classification`) remains the sole deletion authority, so a legitimate all-tool-use session with no text turns is still retained (its raw artifact still carries real Claude Code envelope markers and passes classification). Also added the one missing regression pin: analysis/signal/high_value_ messages.jsonl (the 6th named shape) was already refused via the analysis/ directory heuristic but had no dedicated test using its real field shape (file/timestamp/type/content). That session is deliberately excluded from the empty_sessions purge (word_count=827,894, real content) -- investigation found its real source session is stuck revision_authority='quarantined' and never parsed, so it is currently the archive's only queryable copy of that conversation; deferred to polylogue-6bebe rather than deciding blanket deletion here. Verification: - devtools test tests/unit/storage/test_empty_session_repair_provenance.py tests/unit/sources/test_artifact_taxonomy.py -- 15 passed. New tests pin both the widened-predicate debris case and its "legit all-tool-use" sibling that must NOT be swept in, plus the high_value_messages shape. - devtools verify --quick -- exit 0, all 19 steps green. - Read-only measurement against the live archive (/realm/db/polylogue): before this change, conversation_relationships was absent from `_empty_session_debris_session_ids`'s output; after, it is flagged alongside problems_index/journal/3x toolu_*. Total flagged debris across the archive went from 5023 to 5076 rows (+53, this generalization also catches other same-shaped phantoms, not only the 5 named here). - Pre-existing, unrelated failure noted and NOT fixed here: tests/unit/ maintenance/test_planner_contract.py and test_planner_filter_narrowing.py fail with a TypeError (row_factory not set on a test fixture's index connection) on master (120cf6f) before this change too (confirmed via git stash) -- filed as polylogue-9rdky. Ref polylogue-21qj, polylogue-gvgi (closed as duplicate), polylogue-6bebe, polylogue-9rdky Co-Authored-By: Claude <[email protected]>
…oms (#3583) ## Summary Widens `polylogue/storage/repair.py`'s `empty_sessions` maintenance-repair target so it also catches sessions that have message rows but zero real content (all-zero-word messages), not only literally message-less sessions. Adds the one missing regression test among 6 named phantom-artifact shapes. ## Problem polylogue-21qj found 6 non-transcript files under watched `~/.claude/projects` trees had been ingested as `claude-code-session` rows in the live archive: a sinex analysis-index (`conversation_relationships.jsonl`, 96,748 empty messages), a derived duplicate-messages index (`high_value_messages.jsonl`, 8,763 real duplicate messages), an empty problem-index (`problems_index.jsonl`), 3x oversized-tool-output spill files (`tool-results/toolu_*.json`), and a workflow journal (`journal.jsonl`). Investigating against the live archive (read-only, `/realm/db/polylogue`) and the current checkout found **5 of the 6 shapes are already refused at detection time** by prior merged work (#3426 self-generated `analysis/` dir guard, #3428 `looks_like_code` envelope-marker requirement, c6190d7 letting record content override the `analysis/` guard, and the pre-existing `workflow_journal` `OriginArtifactRule`). Verified live: reran each real file's exact byte content (read from `source.db` + the blob store, since 2 of 3 sinex files no longer exist on disk) through `classify_artifact`/`detect_provider_evidence` — all return `parse_as_session=False`. For cleanup, `polylogue-ne6k` had already built exactly the classifier + dry-run-gated actuator pattern this bead asked for (`repair.py`'s `empty_sessions` target, wired through `polylogue maintenance repair --target empty_sessions`, dry-run by default) — but scoped to literally message-less sessions (`NOT EXISTS messages`). `conversation_relationships` has 96,748 message rows (every one carrying zero blocks/words), so it fell outside that predicate and was never even a repair candidate. ## Solution - Widened `_empty_session_candidate_ids` (renamed from `_empty_session_message_less_candidates`) to also propose sessions where `sessions.word_count = 0` regardless of `message_count`. The existing positive-classification gate (`_raw_artifact_positively_fails_classification`) remains the sole deletion authority — a legitimate all-tool-use session with no text turns still passes classification and is retained (pinned by `test_all_empty_content_session_with_legit_raw_is_retained`). - Added `test_all_empty_content_session_with_phantom_raw_counts_as_debris`, pinning that a `conversation_relationships`-shaped session (many zero-word message rows, relationship-index-shaped raw artifact under `analysis/`) is now flagged. - Added `test_analysis_signal_duplicate_messages_are_not_a_session` to `test_artifact_taxonomy.py`, the missing regression pin for the 6th named shape (`high_value_messages.jsonl`'s real field shape: `file`/`timestamp`/`type`/`content`). - Updated the `empty_sessions` maintenance-target description to reflect the broader predicate. `high_value_messages.jsonl` (8,763 non-empty messages, 827,894 words) is deliberately excluded from the purge — its content is real duplicated conversation text, and investigation found the real source session (`bad69218-...`) is stuck `revision_authority='quarantined'` and never parsed, so this phantom is currently the archive's only queryable copy of that content. Blanket deletion would be real data loss, not garbage collection. Deferred to polylogue-6bebe. ## Verification - `devtools test tests/unit/storage/test_empty_session_repair_provenance.py tests/unit/sources/test_artifact_taxonomy.py` — 15 passed. - `devtools verify --quick` — exit 0, all 19 steps green (also ran again automatically via the pre-push hook). - Read-only measurement against the live archive: before this change, `conversation_relationships` was absent from `_empty_session_debris_session_ids`'s output; after, it is flagged alongside the already-flagged `problems_index`/`journal`/3x `toolu_*`. Total flagged debris across the archive went from 5023 to 5076 rows (+53 — this generalization also catches other same-shaped phantoms archive-wide, not only the 5 named in this bead). - Pre-existing, unrelated failure found and **not** fixed here: `tests/unit/maintenance/test_planner_contract.py` and `test_planner_filter_narrowing.py` fail with a `TypeError` (row_factory not set on a test fixture's index connection) on master (120cf6f) too, confirmed via `git stash` before this change. Filed as polylogue-9rdky. Ref polylogue-21qj, polylogue-gvgi (closed as duplicate), polylogue-6bebe, polylogue-9rdky
Summary
Investigated the reported contradiction that Claude Code Workflow artifacts
appear both correctly normalized (closed beads polylogue-z9gh.4/z9gh.6/2qx.2)
and independently ingested as zero-message sessions. Fixes the one part of
that contradiction that is a live code defect (a self-generated analysis
artifact misclassified as a session), and files/corrects Beads for the parts
that are not: a stale-data reparse gap and one inaccurately-closed bead.
Problem
polylogue-omsw(open) documents zero-message Claude Code sessions whosesource is a non-conversational artifact. Investigating it against the three
closed beads that claim Workflow normalization/admission is done surfaced
three distinct findings, verified directly against the live archive
(read-only
index.db/source.dbqueries) rather than assumed from beadtext:
Live code defect (fixed here): a self-generated analysis index an
agent had written into its own Claude Code project directory
(
analysis/problem_solutions/problems_index.jsonl, JSONL records shapedlike
{"conversation": <id>, "type": "unknown", "preview": ...}) wasingested as a
claude-code-sessionwith zero messages. The recursivesource walk already skips any directory literally named
analysis(
source_walk._SKIP_DIRS), but that skip only guards the treewalkdiscovery route —
classify_artifact_pathhad no equivalent path-onlyexclusion, so the file fell through to payload-shape heuristics.
looks_like_record_entrymisread each record as session content purelybecause
typeis a generic recordish key — the exact "unrecognisedrecord defaults to a session" failure mode
polylogue-9ykn(P0)describes generally.
Not a live defect — stale data: the 172 zero-message sessions under
the
workflows//subagents/workflows/artifact family (164agent_sidecar_meta+ 7workflow_run_snapshot+ 1 other) are notcaused by a current classification bug. Directly testing
classify_artifact_pathagainst the live paths today confirms currentcode already returns
parse_as_session=Falsefor all four Workflowartifact kinds, via the OriginSpec rules PR feat(sources): admit Claude Workflow artifacts through OriginSpec #3088 (
1e0246d77,2026-07-18) added. The 172 rows were all acquired 2026-07-14..26, before
the deployed daemon build advanced past that fix (sinnix's
polylogueflake input only reached a revision containing it on 2026-07-29). The
real remaining gap:
1e0246d77changed session/fact classificationsemantics without declaring an
INDEX_SCHEMA_VERSIONSEMANTIC_REPARSEbump, so the daemon's convergence loop has no signalto reparse already-materialized wrong rows. Filed polylogue-lzh8 to
declare that bump (not executed here — a reparse is a consequential live
action needing explicit operator scheduling, out of this PR's scope per
the task boundary).
Inaccurate bead closure:
polylogue-z9gh.6("Audit ingestioncoverage for Claude Code Workflow sidecars") claims "readiness and
repair commands no longer report healthy solely because
subagents/workflowsis classified as a known sidecar." False aswritten:
assembly_claude_code.py'sorchestration_coverage/orchestration_parse_gapsstruct is computed every ingest pass andconsumed by nothing except its own unit test — dead code. A second,
separate coverage computation (
claude_workflow_materializer.py'sgaps) does run live and is logged during daemon convergence, but onlyas a log line, not a queryable readiness/repair surface. Added a
corrective note to
z9gh.6and filed polylogue-uh9l for theremaining scope.
polylogue-2qx.2andpolylogue-z9gh.4are accurately closed —verified directly:
work_evidence_nodes/work_evidence_edgescontain 7Workflow runs, 122 calls, 164 attempts, 128 structured results, and the
wf_54d4fb2e-841fixture reproduces its exact declared counts (91 attempts,50 calls, 65 results). Not stale beads.
Solution
polylogue/archive/artifact_taxonomy/runtime.py:classify_artifact_pathnow refuses any path containing an
analysis/directory segment as anon-session
METADATA_DOCUMENT, mirroringsource_walk._SKIP_DIRS's intentat the taxonomy layer so the exclusion holds for every acquisition route
(not only the recursive walk that already skips it). Added a regression
test using the observed payload/path shape
(
test_self_generated_analysis_index_is_not_a_session).Beads: filed
polylogue-lzh8(declare the missingSEMANTIC_REPARSEindex bump, quantifying live impact) and
polylogue-uh9l(wire Workflowcoverage into an actual readiness surface, remove the dead struct);
corrected
polylogue-z9gh.6's notes; updatedpolylogue-omswwith thenarrowed evidence distinguishing its still-live
tool-results/toolu_*.jsongap from the now-explained/reparse-only workflow-journal slice.
No repair executed against the live archive; no rows deleted or modified.
Verification
devtools verify(testmon-affected) was not run — this worktree's testmoncache was unseeded (fresh checkout);
--quickplus the two focused testfiles above cover the actual diff.
Ref polylogue-omsw, polylogue-9ykn, polylogue-lzh8, polylogue-uh9l.