Skip to content

sminos 1.40.4: list --subagents shows the live and the just ended, and keeps ended states - #475

Merged
SSFSKIM merged 1 commit into
mainfrom
sminos-subagents-cache
Nov 8, 2026
Merged

SSFSKIM merged 1 commit into
mainfrom
sminos-subagents-cache

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 8, 2026

Copy link
Copy Markdown
Owner

sminos list --subagents used 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:

  • A header with the running and waiting-on-background counts, plus the stalled count when there are any.
  • The live tree, as before.
  • Up to 5 agents that ended in the last 10 minutes, newest first, each with how long ago it ended.
  • +N done (on disk), with no completed/failed/stopped breakdown.

--all, --json and --done keep full per-agent states. --done no longer prints a note about agents it doesn't list.

How it gets there:

  • Past agents are never derived. A past agent is one the engine doesn't hold whose transcript, meta and birth all predate the running process. By the module's own lifecycle rule it cannot be running or waiting, so it is counted from the directory listing and stat alone.
  • Ended states are kept. Completed, failed and stopped, as the disk derivation gives them, are saved per session in $SMINOS_HOME/subagents/<session>.json (0600, written whole).
    • The key is each file's inode, size, mtime_ns and ctime_ns, the agent's resolved parent, and the running process's start.
    • The engine's word goes first and is never cached; running, waiting, stalled and orphaned are never cached.
    • A completed closed turn of the running process re-checks its children each time it is used.
    • A cache file that is missing, corrupt or of another version is ignored and rewritten.
    • The daemon sweeps a session's cache by the same transcript rule as its launch override.
  • Two smaller savings. caller_seat skips the claude agents --json --all subprocess when no seat could match. spawned() reads a transcript's head with a plain read rather than mmap.

Measured on that session:

View Before After, warm After, cold
default 2.6-7 s 0.6-1.0 s 4.2 s
--done 10 full view's cost 0.36-0.41 s —

Under heavy machine load (load average 150+), the default view took 1.8-4.4 s, against 15-27 s before.

Tests:

  • test_subagents.py goes 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.
  • Mutation checks: removing the children re-check, or the process part of the key, each fails a test.
  • --json, --done 10 --json, --all, --all --depth 2 and --done 400 are byte-identical to main on a synthetic 400-agent session, cold and warm.
  • An independent review (reviewer-medium) found no material findings.

sminos 1.40.4.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

…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)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T01:51:47.671075Z 3d05284 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM
SSFSKIM merged commit abaaaa8 into main Nov 8, 2026
11 checks passed
@SSFSKIM
SSFSKIM deleted the sminos-subagents-cache branch November 8, 2026 02:10
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.

1 participant