Skip to content

Resolve routes from the held launch root - #3704

Merged
trissim merged 3 commits into
mainfrom
work/allocation-repair--P1026
Oct 30, 2026
Merged

trissim merged 3 commits into
mainfrom
work/allocation-repair--P1026

Conversation

@trissim

@trissim trissim commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

3 implementation commits, 8 files, +33/-45 against current main. RouteSelection construction: two implementations -> one explicit held-root factory. Dead capture/for_child entrypoints: 2 -> 0. Discarded startup return values across Core src/tests/tools: 6 -> 0 (five production entrypoints plus selected-write child fixture).

Fixes P1026; paired with OpenHCSDev/toad#1365 (P1015). Land both in one integration batch. Core alone removes imports still used by Toad main.

Startup owns the selected root

Before: LaunchRoot.startup installed its chosen root and returned None. CLI callers reconstructed the choice from ambient state.
After: both branches share install and return the exact LaunchRoot. Core CliInvocation, native_pi.main, commander.cli.main, acp.main and worker.run retain the returned object and supply its path to route resolution or wire. selected_write_owner_child follows the same contract. Existing CliInvocation explicit --root precedence remains implemented by LaunchRequest.resolve.

RouteSelection owns construction and source refusal

Before: capture(source) resolved the process default then compared against source. for_child independently constructed the same selection; its env/cwd parameters were unread.
After: RouteSelection.of(LaunchRoot) resolves the held root and captures its normalized observed root and bus identity. root_is_current(source) and require_source(source) compare against that held selection, preserving foreign-source RouteChangedError. No singleton consulted here.

Deleted: free current_root/root_is_current/child_root helpers, optional-source overload/global comparison, dead capture and for_child methods, unused Mapping import and env/cwd parameters. No compatibility aliases, second store or new classes.

Structure and review correction

LaunchRoot(LaunchSelection, LaunchRequest) stays the identity/install owner. RouteSelection stays the route/root/bus value with one explicit factory. The first head retained two unused ambient wrappers and missed native_pi/commander CLI indirect rereads. Review 45685 correctly rejected that: calling dead wrappers process boundaries was an unsupported claim, not ownership evidence. The first correction deleted them and migrated both named callers. Review correction 45764 identified the same indirect reread through bare wire() in ACP and worker. Both now pass root.path. The complete startup census also exposed tests/selected_write_owner_child.py, migrated in the same commit. All six startup call sites across src/tests/tools retain their return; no bare wire() remains in those six files.

IMPL-12: fact=route selection construction; at=old route_selection.py:38/53; derive=delete-copy; by=RouteSelection.of at route_selection.py:29. Paper1 Theorem 4.7: replicas do not remove outside supply. Paper4 section 1 distinguishes unread inputs from semantic deletion: no live consumer uses the deleted entrypoints or parameters.

Source evidence and checks

Retained NRA ModuleSyntaxIndex map at base df4e952 covers 1,507 Core src/tests/tools and Toad production modules; zero parse omissions. Dynamic bindings unresolved, not claimed proved. Map: /home/ts/.cache/agent-scratch/allocation-repair/p1026-ast-before.log.

Core src/tests/tools: zero RouteSelection.capture or RouteSelection.for_child references after correction; zero declarations in route_selection.py. Toad #1365's zero-caller state was established in commander's exact-head review; Toad remains toad-render's checkout and responsibility, not edited here.

Two literal LaunchRoot.current() expressions remain across Core src, at active_route.py:259 and config_options.py:314. This is a lexical count, NOT a claim that all indirect ambient consumers have vanished. All five production startup entrypoints and the selected-write child fixture explicitly resolve or wire startup's returned root; RouteSelection has zero ambient reads. Literal current() count alone did not establish this: the prior two indirect wire rereads were missed despite leaving the same lexical count.

Order check git grep -c 'source: str | Path | None' -- src/agent_comms/route_selection.py: no matches, exit 1, count zero. git diff --check: clean. git diff --stat origin/main...HEAD: 8 files, 33 insertions, 45 deletions.

Integration acceptance still owed

No author tests, import probes, checker runs, profiles, UI/provider runs, installs or live checkout moves, per assigned restriction. Integrator must exercise both startup branches, missing argument refusal, held root different from ambient, source normalization/symlinks and foreign refusal, CLI flag precedence/restoration, native Pi launch selection, commander CLI routing, ACP/worker explicit wire root and selected-write child fixture, then paired Toad provenance/two-app consumer journey.

Relevant existing paths: tests/test_native_owner_launcher_resolution.py, tests/test_session_setup_ordering.py, tests/test_installer_route_lifetime.py, tests/test_install_worker_holds.py. Source checks are not installed acceptance.

Assumed:

  • P1015 finishes its sent-back correction and lands with Core in one batch before paired install.
  • Remaining ambient Core APIs outside these entrypoints retain their existing contracts; this PR does not claim their whole consumer family migrated.
  • CLI explicit-root precedence is intentionally preserved; integrator checks combined flag behavior.

startup hands over the root
native_pi.py:150 used to put it down and ask the process to find it
now it keeps the thing in its hand

@trissim
trissim marked this pull request as ready for review October 30, 2026 14:07
@trissim
trissim enabled auto-merge October 30, 2026 14:07
Copilot AI balanced review requested due to automatic review settings October 30, 2026 14:07

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.

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 30, 2026 •

Copy link
Copy Markdown

debt-src at 7bbd800, every finding:

grew ClientTypeErrors:batrachian-toad/src/toad/acp/agent_session.py +1: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/comms_root.py +4: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/navigation_preparation.py +1: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/screens/main.py +1: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/session_navigation.py +1: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/session_scope.py +2: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/target_commands.py +1: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/thread_actions.py +1: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/widgets/comms_transfer.py +1: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/widgets/context_explorer.py +1: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/widgets/thread_comms.py +1: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
grew ClientTypeErrors:batrachian-toad/src/toad/wire_history.py +1: this change removes or changes an agent_comms name that client file uses; run mypy on it to see which
found ClientTypeErrors:batrachian-toad/src/toad/acp/agent_session.py at batrachian-toad/src/toad/acp/agent_session.py:365 ("type[RouteSelection]" has no attribute "capture"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/comms_root.py at batrachian-toad/src/toad/comms_root.py:369 ("type[RouteSelection]" has no attribute "capture"  [attr-defined]) batrachian-toad/src/toad/comms_root.py:370 (Argument 1 to "require" of "CoordinationAccess" has incompatible type "RouteSelection | UnselectedRoute"; expected "RouteSelection"  [arg-type]) batrachian-toad/src/toad/comms_root.py:375 ("type[RouteSelection]" has no attribute "capture"  [attr-defined]) batrachian-toad/src/toad/comms_root.py:652 ("type[RouteSelection]" has no attribute "capture"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/navigation_preparation.py at batrachian-toad/src/toad/navigation_preparation.py:212 (Module "agent_comms.route_selection" has no attribute "root_is_current"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/screens/main.py at batrachian-toad/src/toad/screens/main.py:241 ("type[RouteSelection]" has no attribute "capture"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/session_navigation.py at batrachian-toad/src/toad/session_navigation.py:21 (Module "agent_comms.route_selection" has no attribute "root_is_current"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/session_scope.py at batrachian-toad/src/toad/session_scope.py:133 ("type[RouteSelection]" has no attribute "capture"  [attr-defined]) batrachian-toad/src/toad/session_scope.py:410 ("type[RouteSelection]" has no attribute "capture"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/target_commands.py at batrachian-toad/src/toad/target_commands.py:17 (Module "agent_comms.route_selection" has no attribute "root_is_current"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/thread_actions.py at batrachian-toad/src/toad/thread_actions.py:37 ("type[RouteSelection]" has no attribute "capture"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/widgets/comms_transfer.py at batrachian-toad/src/toad/widgets/comms_transfer.py:106 ("type[RouteSelection]" has no attribute "capture"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/widgets/context_explorer.py at batrachian-toad/src/toad/widgets/context_explorer.py:363 ("type[RouteSelection]" has no attribute "capture"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/widgets/thread_comms.py at batrachian-toad/src/toad/widgets/thread_comms.py:285 ("type[RouteSelection]" has no attribute "capture"  [attr-defined])
found ClientTypeErrors:batrachian-toad/src/toad/wire_history.py at batrachian-toad/src/toad/wire_history.py:419 (Module "agent_comms.route_selection" has no attribute "root_is_current"  [attr-defined])

@trissim
trissim disabled auto-merge October 30, 2026 14:30
@trissim
trissim force-pushed the work/allocation-repair--P1026 branch from 3c8df27 to e1f124f Compare October 30, 2026 14:31
@trissim
trissim force-pushed the work/allocation-repair--P1026 branch from e1f124f to 4cf2245 Compare October 30, 2026 14:51
@trissim
trissim enabled auto-merge October 30, 2026 15:04
@trissim
trissim merged commit 02e2df0 into main Oct 30, 2026
8 of 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