Repository navigation
sminos 1.40.4: list --subagents shows the live and the just ended, and keeps ended states - #475
Merged
Merged
Conversation
…d keeps ended states The default view of a session with a long subagent history derived every agent's state to count the ended ones: 3-7 s warm, 12.5 s cold, on a session of 1,121 subagents. It now lists the agents running, waiting on background or stalled, then those that ended in the last ten minutes (five at most, newest first, `completed 3m ago`), and ends with `+N done (on disk)` for every other one. The header drops the orphaned count and says stalled only when one is. A past agent (no engine word on it, none of its files written by the running process, or no process runs) is by the module's doctrine ended or orphaned, never running or waiting, nor can it hold a parent waiting: the default view counts it from the directory's listing and stats, its meta and transcript unread. Metas are read when first asked. --all, --done and --json still derive each agent they carry; --done's text no longer derives every agent for counts it never prints. An ended state the disk gives is final until the agent's own files change (a revival writes the meta's revivedAt and the transcript), so it is kept per session at $SMINOS_HOME/subagents/<session>.json (temp file and rename, 0600), keyed by the transcript's and meta's identities (inode, size, mtime_ns, ctime_ns), the parent whose loop's TaskStops can end it, and for an agent of the running process that process's start; a completed closed turn of the running process holds only while no child of it is live, checked on every use. The engine's word is asked first and never kept; running, waiting, stalled and orphaned are never kept; a cache missing, corrupt or of another version is ignored and rewritten. The daemon sweeps the file with its session's transcript, as it does launch/<id>.json. Also: caller_seat asks `claude agents` only when a seat with no session could match the harness's row (no result changes), and an agent's spawn time is read from its transcript's head with a plain read, not a map. Measured on the session above: the default view 4.2 s with no cache, then 0.6-1.0 s warm (was 2.6-7 s); --done 10 0.4 s (was the full view's cost); --all and --json 0.5-0.9 s warm (4.1 s cold). On a 400-agent synthetic session --json, --done 10 --json, --all, --all --depth 2 and --done 400 print byte for byte what origin/main prints, cold and warm. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
sminos list --subagentsused to work out the state of every subagent a session ever had, just to print the summary of the finished ones. In a long session (1,121 subagents, 4.1 GB of agent transcripts) that took 2.6-7 s warm and 12.5 s cold.What the default view shows now:
+N done (on disk), with no completed/failed/stopped breakdown.--all,--jsonand--donekeep full per-agent states.--doneno longer prints a note about agents it doesn't list.How it gets there:
$SMINOS_HOME/subagents/<session>.json(0600, written whole).caller_seatskips theclaude agents --json --allsubprocess when no seat could match.spawned()reads a transcript's head with a plain read rather than mmap.Measured on that session:
--done 10Under heavy machine load (load average 150+), the default view took 1.8-4.4 s, against 15-27 s before.
Tests:
test_subagents.pygoes from 35 to 50 tests, covering the new view, the cache's reuse and invalidation (a revival, a meta rewritten with its mtime set back, a new process start), a corrupt cache, the engine winning, and a cached parent waiting again once its child runs.--json,--done 10 --json,--all,--all --depth 2and--done 400are byte-identical to main on a synthetic 400-agent session, cold and warm.sminos 1.40.4.
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)