Skip to content

Give DM peers one typed encoding, fix stale tests, repin native build - #2763

Merged
trissim merged 19 commits into
mainfrom
fix/red-main
Oct 23, 2026
Merged

trissim merged 19 commits into
mainfrom
fix/red-main

Conversation

@trissim

@trissim trissim commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the tests that are red on main. Each fix is at the owner of the broken fact, or in a test that was hand-building a shape its owner now declares differently.

Source fixes

DM peer had two encodings (IDEN-3). DMHistory.second, direct_history, fetch_page and dm_display_page took str | ThreadTarget and re-decoded the peer with CommandTarget.named. #2733 (0087dc9) narrowed that to raw strings. The peer is now a ThreadTarget everywhere, which fixes test_historical_views::test_normal_comms_api_contains_history_and_execution_stays_live.

Union failures lost their cause. field_codec.py UnionDecoder.decode_candidates (≈line 2417) skipped every alternative whose shape did not admit the value. When none admitted it, nothing was decoded and the error had no __cause__. This came from the #2712 shape filter (8d9c10e, commit 8b63ca4). Now, when the shapes rule out every alternative, the first alternative's own decode supplies the refusal. Fixes test_union_success_releases_rejected_payload_and_failure_keeps_first_cause.

Bus files were declared on bare RootFile. RetiredCommanderFile (#2743, a012a03) and UnfinishedOwnerRename (#2749, a1aab88) were neither durable nor runtime files, so install behaviour for them was undefined. Both are now DurableFile. RootFile.__init_subclass__ (locked_store.py) refuses any new declaration of that kind, which fixes test_bus_files::test_every_bus_file_is_a_declared_root_file.

StoreBackup.interrupted had no caller. It came from #2709 (27e8722). A new StoreBackup.complete_interrupted finishes and retires any restore that a killed install left behind, under a maintenance hold. upgrade() calls it first, before anything reads the bus. Fixes both cases of test_interrupted_rollback.

Activity was declared optional where it is required. assignment_states.py: SelectedResponseNotification.notification reads activity.progress, but #2450 (f9958d7, commit 69304ca) gave activity a None default. A missing activity therefore failed with an AttributeError instead of the call's TypeError. The completed and delivered states had the same type. All three now require AssignmentActivity. Fixes test_historical_notifications::test_recorded_engagement_is_not_an_active_turn.

External Pi records were refused by the union prefilter. field_codec.py _RepresentedDecoder.fits_external (new, beside fits_wire): PiReported.from_wire decodes its value with the external reader, which tolerates keys Pi adds (contextUsage.percent), but the representation admitted only the exact wire record. The #2712 prefilter (8d9c10e; bisected: the payload decodes at 8d9c10e^1 and fails at 8d9c10e) ruled ReportedContextUsage out, and PiOmitted refused the dict. The representation's external shape check now derives from its wire structure's. The codec's admits_* shape checks are renamed fits_* in the same change, because "admit" is banned vocabulary in the debt ratchet. Fixes test_installer_test_runtime::test_checkout_native_tests_use_a_private_runtime (inner: test_native_input_bus_path::test_saved_owner_dm_replies_and_core_reads_exact_native_proof).

RootFile.__init_subclass__ is annotated (**kwargs: object), so debt-src's TypeErrors and UnannotatedParameter counts for locked_store.py stay at the base's.

Test fixes (each test now uses the owner's declaration)

Elsewhere

Environment, not product

  • "A private test runtime home requires uv on PATH": this is TestHome.uv's declared contract (installer/practice.py:86), and those cases pass with uv on PATH.
  • test_install_rehearses_without_changing_the_bus under the default basetemp: it fails with "Insufficient free space before building the practice copy" when /tmp (tmpfs) has less free space than the 5 GiB StorageRule floor. It passes with --basetemp on /var/tmp.

Still red, owned by the install-23 fix

test_install_rehearsal: test_failed_publication_restores_absent_route_without_store_changes and [retained-bus] were hidden behind ForeignRuntimeError and now reach the live carry. There, live reconcile-stores (upgrade.py:955) rewrites bus.sqlite3, while planned-reconcile (upgrade.py:985) planned no rewrite. RehearsalFiles.require_rehearsal then refuses: "Live carries changed files absent from rehearsal: bus.sqlite3". This is the same defect that made install 23 refuse. The fork fixing install 23 owns it in its own PR and uses these tests as its reproduction.

Proof

All touched test files pass locally (-p no:xdist, this worktree's src on PYTHONPATH, uv on PATH). The native pin moved separately in #2766 (f3f069f).

🤖 Generated with Claude Code

trissim and others added 7 commits October 23, 2026 07:48
Three tests and every fresh native build were red on main.

- DM history kept its peer as `str | ThreadTarget` (historical_views.py
  DMHistory.second, read_basis direct_history and fetch_page,
  history_views dm_display_page) and re-decoded it with
  CommandTarget.named, which #2733 (f58e2e3) correctly narrowed to raw
  strings. Any typed peer, including Toad's retained IncarnationThreadTarget,
  crashed on removeprefix. The peer is now a ThreadTarget from the boundary
  in; the re-decode and the redundant require_dm_peer calls are gone, and
  ThreadViewRead decodes its thread name once.
- test_historical_views read bus_files() keys as names; since 1a6fc31
  (#2709) the keys are typed file identities and the paths are the member
  maps. The test reads members through one helper.
- test_outbound_transcript_source hand-built RecordedThreadIncarnation from
  Thread.created_at, which d5cd4bb (#2724) made a CreationTime. The test
  now asks the owner, Thread.incarnation / recipient.require_recorded().
- f4ca048 (#2748) changed stack/native-turn-context.{mjs,d.ts} without
  --update-pins, so prepare-pi-native refused every fresh build (and the
  next install). Repinned: only turn-context.js and turn-context.d.ts move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wners

- RetiredCommanderFile is retained bus state its carry consumes: a DurableFile,
  so every declared root file is durable or runtime again (a012a03, #2743).
- The ratchet guard composes owners through Black, so the formatting measure
  counts nothing and each comparison measures only the classes; 97256db
  flipped the expectation to status 0 while the fixture stayed unformatted.
- bus_files keys are DeclaredFile since #2709: assert the declared owner.
- Routes are written owner-only by their owner; the backup reads the saved
  route through read_active_route since #2731.
- The bus-history round trip runs every step the chain orders before the
  goal-request carry, under the maintenance hold, instead of a hand-picked
  subset that #2701's claim-field carry fell between.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e1e82d6 (#2684) deleted test_backend._replay_stub and _NATIVE_PROMPT_START;
test_native_refusal_recovery.py still imported them for helpers no test calls
since e16d8df deleted the fake-backed tests. Collection died on main.
The one real test stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trissim

trissim commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

#2764's smoke collection fails in your held tests/test_native_refusal_recovery.py:10: it imports _NATIVE_PROMPT_START and _replay_stub from test_backend, which no longer declares either. Only the dead _stub_with fixture helper uses them; the remaining test is the typed provider-failure case. Your PR already owns this file, so I am leaving the deletion with #2763. This blocks the explicitly requested green hosted checks on #2764.

Failing job: https://github.com/OpenHCSDev/agent-comms/actions/runs/39951823803/job/120407905294

Ratchet test and others added 3 commits October 23, 2026 08:31
…estating owners

- StoreBackup.complete_interrupted gives StoreBackup.interrupted its caller: the
  install entry finishes and retires any restore a killed install left, under a
  maintenance hold, before anything reads the bus.
- RootFile refuses a declaration that is neither DurableFile nor RuntimeFile;
  UnfinishedOwnerRename (from #2749) becomes DurableFile.
- UnionDecoder.decode_candidates: when no alternative's shape admits the value,
  the first alternative's own decode states the refusal, so total failure keeps
  its declared cause again (lost in #2712).
- Tests use the owners: DeclaredWireType and RecordMember members in the union
  test, typed carried paths, a committed GivenThreadText title, and rehearsal
  buses owned by the installed runtime and read through its CLI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SelectedResponseNotification, CompletedAssignment and the delivered state read
activity.progress or call activity's notification methods, yet declared
activity as optional; #2450 (69304ca) gave the selected-response override a
None default, so a missing activity became an AttributeError instead of the
TypeError the call contract owes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trissim
trissim marked this pull request as ready for review October 23, 2026 12:39
Copilot AI balanced review requested due to automatic review settings October 23, 2026 12:39

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.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

debt-src at 33003fd, every finding:

introduced NoneAbsence:src/agent_comms/field_codec.py at lines [2185]

Ratchet test and others added 6 commits October 23, 2026 08:43
The drifted-store case compares typed carried paths, and the installed-entry
case decodes the history page messages instead of the unresolvable result shell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#2713 (c3bd967) made SessionBridge.pause return one ResumableBridge; the
tests still unpacked a tuple. Since #2709 (4cad001) a root belongs to one
runtime: session_bridge now publishes its bus to the runtime serving the
bridge, and the swap test hands it to the new runtime at publication, as the
installer does. SourcePrograms reports its runtime. RootFile.__init_subclass__
annotates its keyword arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	src/agent_comms/installer/upgrade.py
#	tests/test_install_rehearsal.py
PiReported decodes its value with the external reader, which tolerates keys
Pi adds (contextUsage.percent), but _RepresentedDecoder admitted only the
exact wire record, so the #2712 union prefilter ruled ReportedContextUsage
out and PiOmitted refused the payload. The representation's external admit
now derives from its structure's external admit.

Also relocks the stack onto toad main, which carries toad #1149.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps main's RegistryStore.digest and the GivenThreadText title in
test_interrupted_rollback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
admit is banned vocabulary (debt_ratchet BannedVocabulary), and the new
_RepresentedDecoder override added four more sites of it. The whole family in
field_codec.py is renamed in this change, and the override now reuses the
base check instead of restating its null test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ratchet test and others added 2 commits October 23, 2026 09:06
It meets raw wire null from outside, which boundary_decoder declares; the
rename touched its line, so NoneAbsence counted the old null test as new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
upgrade() keeps main's command scope and completes an interrupted restore
first inside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trissim
trissim merged commit 08bd6bb into main Oct 23, 2026
7 of 8 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