Repository navigation
perf(token-spy): keep session polling off the HTTP event loop - #4634
Merged
gabsprogrammer merged 2 commits intoSep 13, 2026
Merged
gabsprogrammer merged 2 commits into
gabsprogrammer merged 2 commits into
Conversation
This was referenced Sep 12, 2026
0xacee
marked this pull request as ready for review
September 13, 2026 04:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this matters: The background session poller runs local history scans and session resets synchronously on Token Spy's asyncio loop. A slow configured local filesystem or reset command stalls unrelated HTTP requests, including health checks and proxy traffic.
Offload the local scan and both reset I/O calls to worker threads while keeping polling order, decisions and cooldown updates on the event loop.
Validation:
Overlap check: all-state title/file searches. Other event-loop PRs (#3739/#3498/#3350/#2700) affect remote-provider probes. #4569 bounds scanner memory and #4583 binds local reset selection; neither prevents poller I/O from blocking the proxy loop.
AI assistance: implemented and validated with Codex. Review required before merge: independent review of background session operations. Tests simulate stalled I/O; no live agent or remote reset was exercised.
Combined validation: c08b6695ff14 on public-beta base 9fc9f61. Token Spy: 64 passed, 1 skipped, including assessed-target deletion and event-loop responsiveness together.
Merge guidance: tested Token Spy main.py order is #4561, #4569, #4583, #4634, #4640. The #4583/#4634 poller conflict must retain await asyncio.to_thread for status and reset, include_session_id=True on assessment, session_id=status["_reset_session_id"] on deletion, and cooldown updates only after action == "killed".