Skip to content

Key context requests by the incarnation, not its name (ContextRequestKeyPhase) - #2659

Merged
trissim merged 2 commits into
mainfrom
slop/context-request-key
Oct 23, 2026
Merged

trissim merged 2 commits into
mainfrom
slop/context-request-key

Conversation

@trissim

@trissim trissim commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

ContextRequestKeyPhase (REMAINING-SLOP-PLAN 4.2, IDEN-6).

ContextRequest was keyed on (thread_name, thread_birth) and newest() filtered on the current name, so after a rename latest() returned AbsentContext and the turn counter restarted at 1. Paging covered for it by fanning out over every registry alias, then re-resolving each row's owner.

A recorded incarnation's identity is its birth: RecordedThreadIncarnation compares and hashes wire_birth (thread_identity.py:146-152), and lookup is a hash of that birth. The table now keys on thread_birth alone.

Deleted: the thread_name generated column and its index, the alias fan-out (recorded_names in paging), the post-page owner recheck, and the RegistrySnapshot threaded through page only to feed the fan-out.

Carry: tools/cutover/carry_context_request_key.py, run by agent-comms install. DurableTables cannot derive a dropped generated column (derive_schema refuses: "ContextStore differs from its declaration"), so the step rebuilds the table through ContextRequest.rebuild.

Proof on a copy of the live store (51355 rows):

  • The id/identity/versions/size digest is identical before and after.
  • A second dry run reports 0.
  • The same birth under a new name now returns request 51355 instead of AbsentContext.

Tests: context tests (test_claim_bus_read, test_context_manifest_deltas, test_context_source_inspection, test_turn_context_wire, test_unreadable_history_observation): 44 passed.

Phase evidence: no thread_name in src/agent_comms/context_store.py.

Overlap: #2646 (MI, SingletonRow) touches the same import lines in context_store.py. Whoever lands second resolves two lines.

🤖 Generated with Claude Code

trissim and others added 2 commits October 23, 2026 03:50
…KeyPhase)

ContextRequest was indexed on (thread_name, thread_birth), and newest()
filtered on the current name (IDEN-6). After a rename, latest() missed
every earlier request, returned AbsentContext and restarted the turn
counter at 1; paging fanned out over every alias in the registry to
paper over it, then re-resolved each row's owner to check the fan-out.

A recorded incarnation's identity is its birth: RecordedThreadIncarnation
compares and hashes wire_birth, and its lookup is a hash of that birth.
The table now keys on thread_birth alone; append and every read require a
recorded incarnation. The thread_name column, the alias fan-out, the
post-page owner recheck and the registry snapshot threaded into paging
only to feed that fan-out are gone.

Carry: tools/cutover/carry_context_request_key.py rebuilds the table
through its declaration (the generated name column cannot be derived
away), keeping every row and id. On a copy of the live store: 51355
rows, identical id/identity/versions/size digest before and after,
second dry run reports 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 07:51

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@trissim
trissim merged commit 3a09a10 into main Oct 23, 2026
5 of 8 checks passed
@github-actions

Copy link
Copy Markdown

debt-tools at 233ea6b, every finding:

grew LintFindings:tools/cutover/carry_context_request_key.py +1
grew Unformatted:tools/cutover/carry_context_request_key.py +1

@github-actions

Copy link
Copy Markdown

debt-src at 233ea6b, every finding:

grew LintFindings:src/agent_comms/context_store.py +1

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.

2 participants