Skip to content

Type the remaining thread lookups and delete their constructor re-checks - #3744

Merged
trissim merged 1 commit into
mainfrom
work/root-ids-typed
Oct 30, 2026
Merged

trissim merged 1 commit into
mainfrom
work/root-ids-typed

Conversation

@trissim

@trissim trissim commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary: 3 phase greps 1/0/0 to 0/0/0. 14 annotations retyped in 7 modules (1 the phase pattern sees, 13 it cannot). 4 constructor re-checks deleted. 22 lines added, 33 removed. No wire, schema or stored-row change.

Plan phase: id128_nominal/root_ids (RootIdsPhase). Earlier nominal PRs had already cleared nearly all of the plan's 127 sites, so the phase's own remainder on main was one line.

Grep counts (git grep -nE PATTERN -- src ':!src/agent_comms/skills/', base d6084cb)

Pattern Before After
\b(wire_root_id|root_id|lookup|recipient_lookup): (str\b|Id128\b|Annotated\[(str|Id128)\b) 1 (pi_rule_gate.py:102) 0
Id128Text\.decode\((self\.)?(owner\.)?(wire_root_id|root_id|lookup)\) 0 0
FieldCodec\.decode\(Annotated\[str, *Id128Text\] 0 0
Wider check, not a phase gate: any \w*(root_id|lookup)\w* annotated str, Id128, Annotated[str|Id128, Optional[str, list[str], tuple[str 14 0

What changed

Same kind under names the phase pattern cannot see, so retyped with it (one codemod, not committed):

Annotation Producers
pi_rule_gate.py:102 typed_by(lookup) pi_rule_gate.py:96 require_recorded().lookup, typed at registry_provenance.py:90
attempt_start.py:30 AttemptStart.owner_lookup selected_turn.py:125-128 participant.lookup, typed at selected_participant.py:57
coordination_response.py:109 resolve_retained(owner_lookup) coordination_response.py:266 (recipient_lookup, typed at :205, :231), attempt_recovery.py:305 (incarnation.lookup)
execution_store.py:41, :54 create, create_after_triage selected_participant.py:94, selected_turn.py:263, selected_triage.py:137, all participant.lookup
native_input_record.py:203,207,344,358 native_runtime_input.py:222,261, from transcript_sources.py:642 self.recipient.lookup
native_input_record.py:452 NativeInputRecord.owner_lookup Parent annotation; overridden with ThreadLookup by all three stored subclasses: native_runtime_input.py:277, historical_native_inputs.py:54, native_prompt_binding.py:58
bus.py:400,411, bus_tables.py:65,104 sender_lookups goal_management.py:247, goal_waits.py:207, pi_rule_gate.py:106, all incarnation...lookup

Wire: nothing here changes what is encoded. Each retype is a parameter, or AttemptStart (never passed to FieldCodec), or the parent annotation every stored subclass overrides. No env, stored-file or older-runtime path produces these values. No installer wire record is touched, so older workers read the same bytes.

What was deleted

Each was a check on a field already declared ThreadLookup; a value that passed the decode is 32 hex, so non-empty and bounded said nothing further.

Deleted Boundary where the value entered typed
CurrentExecutions.__post_init__ owner_lookup checks, and the three imports they left unused Field coordination_tables/executions.py:231; written participant_store.py:76 from lookup: ThreadLookup
ExecutionRecord.__post_init__ owner_lookup loop Field coordination_tables/executions.py:346; written execution_store.py:106 from the parameter typed here
AttemptRecord.__post_init__ owner_lookup entry Field coordination_tables/attempts.py:183; written attempt_start.py:99 from ExecutionRecord.owner_lookup
OwnerFence.__post_init__ owner_lookup entry Field owner_fence.py:33; sole constructor attempt_start.py:41, from AttemptStart.owner_lookup

Behaviour change, stated: a directly constructed row holding an empty or over-long plain str lookup no longer raises in __post_init__. Only tests construct these with raw text (test_s3_legality_behavior.py:222, test_optional_awareness_projection.py:324), and neither asserts that refusal. No table DDL changes.

Left alone, on purpose

  • acp_extension.py:643 wire_root: str holds a filesystem path (thread_configuration.py:27 str(self.root.resolve())), not a RootId.
  • wake_policy.py:93,122 FieldCodec.decode(ThreadLookup, lookup) are from_wire boundaries; the one decode stays.

Callers I could not prove

  • native_runtime_input.py:210,229,257 and execution_store.py:67 take owner_lookup with no annotation. I traced their callers by hand; mypy does not check these parameters, and no grep will catch one going wrong.
  • Mypy ran only on the 10 changed files with imports silenced, so call sites in other modules were read by hand, not machine-checked.

Checks run

  • tests/test_s3_legality_behavior.py tests/test_coordination.py: 76 passed.
  • ruff --select F,I: per-file counts equal main's on all 10 files.
  • mypy on the 10 files: no new lookup error. The 3 lookup lines it reports (coordination_response.py:232 twice, :239) are unedited code.
  • No local full suite and no local NRA gate; CI runs debt-src.

Overlap

Open PRs #3566, #3670, #3614, #3616 and #3607 touch bus.py, bus_tables.py or native_input_record.py. The plan's "no phase edits files of an open PR" dates from dfc7d8976 and named #2914. None of the diffs I could read edits these annotation lines (#3566, #3670, #3616, #3607); #3614's diff is too large for the API, so it is unchecked.

🤖 Generated with Claude Code

Closes plan phase id128_nominal/root_ids (RootIdsPhase). On main only one
of its grep hits was left: pi_rule_gate.py:102. Thirteen more lookup
annotations sit under names the phase pattern cannot see (owner_lookup,
sender_lookups); they carry the same kind, so they change with it.

Retyped to ThreadLookup by one codemod (14 annotations in 7 modules).
None of them changes what goes on the wire: every one is a parameter, or
AttemptStart (never encoded), or the NativeInputRecord parent annotation,
which all three stored subclasses already override with ThreadLookup.

Deleted by hand, each already a typed value at its boundary:
- CurrentExecutions.__post_init__ owner_lookup checks. Field typed at
  coordination_tables/executions.py:231; written at participant_store.py:76
  from `lookup: ThreadLookup`; stored rows decode through FieldCodec.
- ExecutionRecord.__post_init__ owner_lookup loop. Field typed at
  coordination_tables/executions.py:346; written at execution_store.py:106
  from the parameter typed here, fed by selected_participant.py:57.
- AttemptRecord.__post_init__ owner_lookup entry. Field typed at
  coordination_tables/attempts.py:183; written at attempt_start.py:99 from
  ExecutionRecord.owner_lookup.
- OwnerFence.__post_init__ owner_lookup entry. Field typed at
  owner_fence.py:33; sole constructor attempt_start.py:41, from
  AttemptStart.owner_lookup, whose sole constructor is selected_turn.py:125
  passing participant.lookup (selected_participant.py:57).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 20:48
@trissim
trissim enabled auto-merge October 30, 2026 20:48

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 insufficient remaining quota. Try requesting a review at a lower effort level.

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 added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 5e79f9c Oct 30, 2026
9 checks passed
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