Skip to content

Load optional startup imports through the preparation workers - #581

Merged
trissim merged 4 commits into
mainfrom
fix/history-frame-work-20261008
Oct 8, 2026
Merged

trissim merged 4 commits into
mainfrom
fix/history-frame-work-20261008

Conversation

@trissim

@trissim trissim commented Oct 8, 2026 •

Copy link
Copy Markdown

Process naming is now a static ApplicationLifetime.set_process_title that startup and the CLI server callers share, replacing the function in cli.py. The httpx import for usage reporting runs on a preparation thread, and the version check in version.py is reorganized to take the thread runner. The change touches four source files and adds an evidence note.

ApplicationLifetime owns process naming; startup and all three CLI server
consumers use its original behavior. Delete the CLI function and startup's
reverse import of the command module.

VersionMonitor owns its installed-version preparation and complete query.
Move cold httpx, packaging and TOML imports plus installed-version parsing
through the supplied existing preparation runner. App supplies its bounded
PreparationRuntime.run_thread; standalone execution uses asyncio.to_thread.
Client construction uses the same runner. Preserve async HTTP on the original
loop, async-with closure, cancellation, failure handling and upgrade notices.
Opt-in UsageReports also acquires its cold HTTP module through preparation;
its policy, request and error boundary remain unchanged.

NRA SourceModule/module_syntax_index before/after traced 862 production files
across Toad, current Core and native Textual roots, zero parse omissions under
Python 3.14. Process-title definition moves cli.py to ApplicationLifetime;
startup and run --serve, acp --serve and serve callers all migrate. Version
query definition moves module scope to VersionMonitor; check and standalone
__main__ migrate. No former imports/calls remain. Dynamically imported outside
consumers were not proved by AST; no compatibility alias retained.

Verification: actual PreparationRuntime + httpx/local HTTP response verified
cold imports off UI thread, upgrade notice substitution, malformed response
retaining previous status, cancellation propagation and client closure.
Lifecycle title invocation does not import toad.cli. Source CLI --help passes.
No App/provider launch; integration owner carries installed App qualification.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 15: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.

@trissim
trissim merged commit 90e4a74 into main Oct 8, 2026
2 checks passed
@trissim trissim changed the title Move optional startup imports through existing preparation Load optional startup imports through the preparation workers Oct 11, 2026
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