Skip to content

client: the local route's Core lives in its own module; Qt never imports it - #2108

Merged
trissim merged 2 commits into
mainfrom
qt-client-no-local-core
Nov 18, 2026
Merged

trissim merged 2 commits into
mainfrom
qt-client-no-local-core

Conversation

@trissim

@trissim trissim commented Nov 18, 2026

Copy link
Copy Markdown

What

toad.client.connection held LocalCoreConnection, LocalObserving and LocalAnsweringReads next to the remote connection. Because of that, every Qt start imported agent_comms.comms.Comms, along with LocalCoreAccess, LocalRouteObservation, RootRuntime and LaunchRuntime, even though Qt only ever builds ProcessRemoteCoreConnection.

  • These classes move to toad.client.local_connection, together with the launch's connection choice (select_connection, formerly CoreConnection.select). Only the TUI imports this module (toad.app, toad.cli).
  • Opening a selected route is now the connection's job. LocalCoreConnection.open_selected(access, selected) builds Comms, and CoordinationAccess no longer names Comms. CoreConnection.open_selected is abstract. The remote connection refuses it with RemoteRouteNotSelectable, the same way its route_selection already does.

Measured

python -X importtime -c 'import toad.qt.main', interpreter from ~/.local/bin/toad, PYTHONPATH=<agent-comms main>/src:<toad>/src:

agent_comms modules agent_comms self, plain at CPUQuota=45%
main 706 2.47–2.57 s 5.3–6.7 s
this PR 705 2.31–2.81 s 5.0–6.3 s (noisy host)

On its own this PR gains nothing measurable. Qt still reaches Comms through agent-comms' own client chain (transport.remote_core → transport.mcp → transport.connector_caller → comms, and ui_model.observation → team.team_heartbeat → ...). Those chains get cut in the companion agent-comms PR. This PR is the toad half: without it, removing them in agent-comms would still leave Qt loading Core through toad.

Checks

  • tools/qt_inherit_ratchet.py: shared-looking modules loading Textual UI 11 (baseline 11), toad.qt→widgets imports 0 (0), bare Qt classes 21 (21), parallel copies 0 (0)
  • tools/shadow_check.py: empty methods shadowing real ones 0 (baseline 0)
  • tools/android/check.sh: rc=0, function-local imports reaching an unshipped package 15 (baseline 15), and "shipped app ran every view kind and bound key on a scratch bus"
  • tests/guards plus the touched test files: the same failures as main in this environment (7 guards, 13 textual), and no new ones

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

trissim and others added 2 commits November 18, 2026 02:21
…rts it

toad.client.connection held LocalCoreConnection, LocalObserving and
LocalAnsweringReads beside the remote connection, so every Qt start imported
agent_comms.comms.Comms (and LocalCoreAccess, LocalRouteObservation) although
Qt only ever builds ProcessRemoteCoreConnection.

They move to toad.client.local_connection with the launch's connection
choice (select_connection), imported by the TUI's app and cli only. Opening a
selected route is the connection's: LocalCoreConnection.open_selected builds
Comms; CoordinationAccess no longer names Comms. The remote connection refuses
it as its route_selection already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
@trissim
trissim marked this pull request as ready for review November 18, 2026 07:32
@trissim
trissim merged commit d57e8d6 into main Nov 18, 2026
1 of 2 checks passed
trissim added a commit that referenced this pull request Nov 18, 2026
…ntry only

After #2108 the local route lives in toad.client.local_connection. It is
this machine's own bus, the one connection agents start under: its
LocalCoreConnection carries SpawnsAgentProcesses and reads a chosen bus
with select_connection. toad.qt.main (the desktop entry, after its first
frame) selects the connection and hands it to client_start.serve_launch,
so the shared Qt modules and Android's start never import it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
trissim added a commit that referenced this pull request Nov 18, 2026
…s it starts none (#2111)

* Qt starts ACP agents through the shared AgentConversation chain

AgentConversation owns attach/resume/start; AgentTurnEvents owns the
agent-event handlers both Conversation and QtConversation inherit;
SessionTitles/FirstPromptTitle own titling for MainScreen and the Qt
ACP view. Agent spawning moves to OperationalSessionSources.spawn_agent
behind AgentProcesses (Android: NoAgentProcesses refuses). Qt gets a
QtSurfaceBinding (tool/terminal live blocks, permission asks through
QtQuestion), and --agent on toad.qt.main attaches a launch binding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

* Qt agents run under the local Core connection; failures in Qt workers surface

The connection owns whether agents spawn (LocalCoreConnection does, a UI
profile does not), and toad.qt.main / qt_drive select their connection as
the TUI does. AgentBinding.launched resolves -a for both. Qt's run_worker
shows a failed worker instead of holding it unread, call_later awaits a
coroutine callback, notify is shared InputAttention, a closed Qt view
retires its agent surface, and the scripted peer gains a terminal step for
one FULL_TURN that the TUI test and the Qt drive both send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

* Qt live tool and terminal rows draw as history's tool rows; Qt views close as Textual's

A live tool call is a QtToolTranscriptFragment (AgentActivityPresentation.tool:
title, status, details behind the disclosure), a terminal the same with its
output open; no row_markdown copies in tool_output. Qt's workspace finish
closes a view's receivers and history reads before deleting it, as
Textual's teardown does; QtConversation owns the history retirement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

* Qt launch selects its Core as Toad's does: client_start.serve_launch, -a, chosen buses

toad.qt.main (now split, client_start loading after the first frame) selects
its connection with CoreConnection.select and attaches -a through
AgentBinding.launched; a chosen bus is read by the connection the window runs
on (CoreConnection.chosen), so a local desktop window switches buses as
Textual does and Android keeps decoding in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

* Qt finish leaves closing a view's receivers to SessionEntry.forget

detach already closes them (forget -> close_core_events); a second close
unsubscribed the activity rows twice. The history's reads end there now
that QtConversation.close_core_events retires the history for every
Qt conversation, thread views included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

* Desktop Qt selects its local bus through local_connection, from the entry only

After #2108 the local route lives in toad.client.local_connection. It is
this machine's own bus, the one connection agents start under: its
LocalCoreConnection carries SpawnsAgentProcesses and reads a chosen bus
with select_connection. toad.qt.main (the desktop entry, after its first
frame) selects the connection and hands it to client_start.serve_launch,
so the shared Qt modules and Android's start never import it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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