Skip to content

The pilot waits only on pumps that owe work; the queue is the pump's and says so - #252

Merged
trissim merged 1 commit into
mainfrom
perf/pilot-waits-for-owed-work
Nov 6, 2026
Merged

trissim merged 1 commit into
mainfrom
perf/pilot-waits-for-owed-work

Conversation

@trissim

@trissim trissim commented Nov 6, 2026

Copy link
Copy Markdown

Pilot._wait_for_screen woke the app and every widget on screen after each pause/press/click: 757,738 posts and 588,863 Idle passes across Toad's suite, almost all on widgets with nothing queued.

The queue now carries its activity (Owing after a put, Settled when its pump asks and finds none); MessagePump.call_after_pending asks it, and the pilot calls that instead of call_later. Queue moves into message_pump.py and _queue.py is deleted: it existed only to run pumps.

  • Toad's eight heaviest test files: 82.7 s -> 63.6 s wall (-23%), same three pre-existing failures.
  • Textual queue/pilot/message_pump/on/screens: 195 passed. mypy: no new errors vs main.
  • No Toad API change, so no consumer-first ordering needed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XbFMSqJMarXn2ZE8iAL7Sd

…and says so

Pilot._wait_for_screen posted a Callback to the app and every widget on the screen after
each pause, press and click, then waited for all of them. Waking an idle widget is not free:
it dispatches the Callback and then runs a full Idle pass. Across Toad's suite profile that
was 757,738 posts from _wait_for_screen and 588,863 _on_idle passes, almost all on widgets
with nothing queued.

- The message queue carries its activity: Owing after a put, Settled when its pump asks for a
  message and finds none (everything before is handled, idle work included). A refresh
  already enqueues Prompt through check_idle, so outstanding work always shows as a put.
- MessagePump.call_after_pending asks that activity: Owing schedules the callback behind the
  work, Settled answers False. _wait_for_screen keeps its shape and calls it.
- Queue moves into message_pump.py and _queue.py is deleted: it existed only to run pumps,
  and the split was what would have needed an import cycle once its state had pump behaviour.

Toad's eight heaviest test files (FamilyMeta agent_comms, same Toad): 82.7 s -> 63.6 s wall,
same three pre-existing channel-tab failures. Textual queue/pilot/pump/on/screens: 195 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XbFMSqJMarXn2ZE8iAL7Sd
Copilot AI balanced review requested due to automatic review settings November 6, 2026 15:04

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 merged commit 6cdc6e8 into main Nov 6, 2026
4 of 25 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