Skip to content

feat(storage): declare hook spool topology and durable carrier identity - #4171

Merged
Sinity merged 1 commit into
masterfrom
feature/packet/polylogue-sd2vk.2
Aug 26, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/packet/polylogue-sd2vk.2

Conversation

@Sinity

@Sinity Sinity commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Summary

Implements polylogue-sd2vk.2: typed hook spool topology, a durable physical-carrier relation, and immutable hook-event identity.

Problem

Hook events carried one representative source_path with no durable record of which physical carrier (primary spool vs legacy read-only roots) delivered them, and replay could silently rewrite a logical hook row's semantics.

Solution

  • Source migration v36 (additive, backup-required, train manifest 036.train.json): hook_event_carriers STRICT table keyed (source_id, relative_path) with role CHECK ('primary-writable' | 'legacy-read-only') + event/blob index. Historical rows deliberately not backfilled — documented in the migration.
  • _insert_hook_event enforces immutability: identical replay is a no-op; a semantic identity change raises typed HookEventConflictError (source_path excluded — first-observed representative is preserved, new carriers land in the relation).
  • hook_payload blob refs switch to ON CONFLICT DO NOTHING, replacing the old delete-then-replace dance the mutable upsert required.
  • Spool drain records its carrier through the relation.

Verification

  • Focused suites: 99 + 51 passed; verify schema-versioning, oracle-integrity, --quick: all passed.

Residuals

  • Selected verify refused (testmon seed environment-incompatible with current master; known seed-freshness residual).

🤖 Generated with Claude Code

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bc738094-6c0e-4d94-b993-3b7d726b9bc2


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

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit 50a7579 into master Aug 26, 2026
3 checks passed
@Sinity
Sinity deleted the feature/packet/polylogue-sd2vk.2 branch August 26, 2026 02:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cefe87b844

ℹ️ 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".

Comment thread polylogue/sources/hooks.py Resolved
Comment thread polylogue/sources/hooks.py Resolved
Comment thread polylogue/sources/hooks.py Resolved
Sinity added a commit that referenced this pull request Aug 26, 2026
## Summary
Implements polylogue-awy5: durable acquisition-failure representation —
source_generations, source_items, and source_item_reconciliation tables
(source migration v37 after rebase over #4171's v36), generation-bound
logical-coordinate identities with idempotent transitions, typed
dispositions for downstream failure/cancellation/interruption,
legacy_unknown batch fallback replaced by typed downstream failure.

## Verification
378 focused source/pipeline/storage/daemon tests green post-rebase;
schema-versioning + oracle-integrity + quick gate green (commit
564b683). Migration renumbered 036→037 after the hook-carriers v36
landed; slot-collision defect filed separately.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
Sinity added a commit that referenced this pull request Aug 26, 2026
## Summary
Round-2 corpus-fix lane (rest cluster): closes out the remaining corpus
run `2b00a953` failures — lineage/MCP/storage/daemon — and repairs the
MCP alias regression that #4226 introduced.

## Problem (evidence)
31 corpus failures across the rest cluster, classified per-failure:
- **Real regressions**: the daemon's `/api/operation` route had no
`RouteContract` entry (contract census red); MCP query alias lowering
(`_mcp_aliases` mapping every declared name to its dataclass
`spec_attr`) broke list pagination, provider/tag filters, cross-adapter
query parity, and retrieval readiness; the startup recovery read path
opened SQLite outside the controlled interruptible reader.
- **Stale expectations**: lineage validation (index v73), model runtime
(#4173), blob-GC v33 (schema evolution through v37 — test now pins
`target_version=35`, the version its DDL snapshot proves), hook carrier
identity (#4171), continuity capability catalogue (#4190), dev-loop
worker count (#4222), and others per the lane report.
- Additionally, #4226's `normalized = dict(params)` skipped
normalization entirely, silently dropping the three genuine MCP-only
alias spellings (`has_tool_use`, `has_thinking`, `has_paste_evidence`) —
`SessionQuerySpec.from_params` only reads the `filter_has_*` names.
Restored `normalize_query_params` with the alias map narrowed to exactly
those three.

## Verification
- All 40 nodeids from the corpus failure set
(`/realm/tmp/work/corpus5-failed.txt`) → **40 passed** on this branch
(rebased on master with #4226 + #4227 in).
- `devtools test tests/unit/mcp/test_query_request_contracts.py
tests/unit/test_cross_surface_agreement.py
tests/unit/storage/test_retrieval_readiness_laws.py
tests/integration/test_mcp.py` → 26 passed.
- `devtools verify --quick` → all 15 gates ok.

## Residuals
- One listed failure
(`test_submit_failure_cleans_every_admitted_future_and_reservation`) was
not reproducible in-lane and is unchanged; if it reappears in the corpus
rerun it needs its own investigation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
Sinity added a commit that referenced this pull request Aug 26, 2026
## Summary
Corpus run 4 fix lane (sources/ingest cluster): fixes 6 real ingest
regressions and updates 3 genuinely stale expectations from the
18-failure residual set.

## Problem (evidence)
Corpus run `7a195ff2` (first run against a frozen master, `34ddfe09d`)
failed 9 sources-cluster tests. Root causes traced per-test:
- Source v36's immutable hook-event carriers (#4171) broke codex
state-db ingest: a stable per-thread `hook_event_id` could not represent
repeated A→B→A state observations — re-ingest raised carrier conflicts
(4 tests: session-count, title/spawn attach, source-only recovery,
latest-observation replay).
- `jsonl_complete_prefix` conflated a malformed record with an
incomplete tail, so malformed JSONL was clipped and retried forever
instead of recording a terminal decode outcome (2 tests).
- Runtime artifact classification read the combined multi-segment text,
letting a marker inside a THINKING block overwrite the parser's
TEXT-only verdict (1 test).
- Stale expectations (3): excluded-cursor proof now sees deferred
partial evidence for stable truncated tails; backfill tests now pin
observation-scoped immutable carrier identities and durable observation
order.

## Solution
- Hook-event identity for codex state evidence becomes
observation-scoped (`:observation-NNN` suffix from raw-revision
acquisition order), with explicit `carrier_relative_path`.
- `JsonlBoundary` gains `malformed_record`; malformed records surface as
terminal decode instead of an eternally-retried frontier clip.
- Message-type classification uses the same TEXT-only projection
materialization sees.

## Verification
- The 9 target tests: 9 passed (each confirmed failing first).
- Complete affected files: 277 passed.
- `devtools verify --quick` + pre-push quick baseline: green.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
@Sinity

Sinity commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

Codex review threads on this PR whose cited code is gone (checked against master at 23f91a5):

Resolving these threads.

@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at ef10e59):

Resolving the fixed, stale and refuted threads; tracked threads stay open.

@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at 0914f89):

Resolving every thread listed; confirmed defects are fixed under the named bead.

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.

1 participant