Skip to content

fix(token-spy): reset the assessed local session - #4583

Merged
gabsprogrammer merged 1 commit into
Osmantic:public-betafrom
0xacee:fix/token-spy-reset-the-assessed-local-session
Sep 13, 2026
Merged

gabsprogrammer merged 1 commit into
Osmantic:public-betafrom
0xacee:fix/token-spy-reset-the-assessed-local-session

Conversation

@0xacee

@0xacee 0xacee commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Why this matters: The local-agent poller assesses the newest JSONL history by modification time, then calls a reset helper that independently selects the largest file. With an older large conversation and a newer over-limit one, it deletes the older conversation and leaves the assessed problem running.

Carry the assessed session ID into the local poller's reset operation. If that file has disappeared, stop without selecting another history. Record the cooldown only after an actual reset. Manual/proxy reset selection keeps its existing largest-session behavior; the public session-status response gains no internal selection metadata.

Validation:

  • Exercise the real production polling loop against two temporary histories and their sessions.json index.
  • Before: 2 failed, 2 controls passed. After: 4 focused tests passed; full Token Spy suite 26 passed, 1 skipped.
  • Verify only the newest assessed file/index entry is removed; disappearance never retargets the older file or records a successful reset; manual selection and public status shape remain covered.
  • Changed-file Ruff E/F/W and git diff --check pass.

Overlap check: searched live/all-state titles and changed files. Inspected #1923 (shell session-manager active-ID extraction), #2803 (atomic index writes) and #2691 (I/O exception types). #4569 bounds local scanner memory. None binds the poller's reset target to the history it assessed.

AI assistance: implemented and tested with Codex. Review required before merge: independent review of destructive session operations and live validation. Deletion tests touch synthetic temporary files only. This binds selection by session ID; it does not add filesystem locking or replace the separate atomic index-write proposals.

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".

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