Skip to content

sminos 1.46.1: an idle uplink stops re-reading what did not move - #489

Merged
SSFSKIM merged 4 commits into
mainfrom
sminos-uplink-idle
Nov 12, 2026
Merged

SSFSKIM merged 4 commits into
mainfrom
sminos-uplink-idle

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Why

sminos daemon uplink idled at 11–13 % of a core on two Macs. A file-call trace of one of them (58 hub projects open, 101 registered, 73 seats, nobody speaking) showed about 7,550 file calls a second:

  • 37 %: each project's uplink.json opened and parsed three times on every upload pass (1.6 passes a second), by a read that was outside the stat-keyed cache.
  • 22 %: for every session whose launch directory the process may not read (26 here), every project was probed for that session's writer file under each of the machine's names, on every cache generation (10 s or less). Nearly every open failed.
  • the rest: getcwd before knowing a path is in a protected folder, the plugin manifest opened once per project per presence pass, and smaller sites.

On the interpreter side, the words and reach passes copied and re-indexed every log every 10 s (the memo was keyed on a list that was a fresh copy each time), and the host pass walked every host event on every pass.

What changes

Nothing the daemon does or when it notices a change, with one exception noted below.

  • HubLog.state() reads uplink.json by stat (json_at), and one project's turn in a pass reads it once (Link.upload_pass).
  • recorded_project lists each project's log/ once per cache generation and reads only the projects that hold a writer file of the session (plain or an audience stream, under the name now or a former one). Its answer is always a Guessed, which nothing joins, moves or retires a session on. last_project, whose answer a reconciliation does act on, reads every project's files at the time of the call, as before. known_projects lists projects/ without glob's extra lstat.
  • withheld() asks for the working directory only for a path inside a protected folder.
  • desk() reads the plugin manifest by stat.
  • words_due / reach_due index the shared merged log, so the addressee index is kept while no file of the log moves. Every consumer only reads the events; the ask frames copy them.
  • Link.host_pass skips a host file that has not moved since a pass found nothing in it past the cursor; HubLog.is_own keeps its set of names while the identity holds.

The one difference: a streams.json entry naming a stream whose file was never written no longer triggers the registration repair that writer_path did as a side effect of that read.

Left for later, in docs/doperpowers/TECH-DEBT.md with measured shares and triggers: publishing members once a tick, one seats() per member read, how often the whole own-writer look runs, when the plane forgets its caches, the probes for projects with no local member, and what bench_scale.py lacks to reproduce this cost.

Tests

sminos/tests/test_idle_reads.py (21 tests) counts calls rather than time: no open of an unchanged uplink.json; recorded_project and last_project equal the 1.46.0 implementation on a fixture with a former name, a stream-only session and a moved retirement; recorded_project makes no failed open and at most one listing of each log/ per generation; last_project sees a writer file or a stream written after another session's lookup in the same generation; no getcwd outside protected folders; one addressee index across passes over an unchanged log; an unchanged host file not walked again, and an appended event, a cursor that went back and a rename all followed.

After it is installed

The same trace on the same machine, for the before and after figures.

Hold the merge until the P5 closing run's machine swaps are done: a sminos update restarts the daemons.

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

…ks a host file only once it moved

An idle uplink opened every open project's uplink.json three times each
upload pass (dead, voided, host_sent: 37 % of its 7,550 file calls a second
on the MacBook) and walked every event of every host file each pass.

- HubLog.state reads through sminos.json_at: a stat while the file holds
  still (save writes it whole, by rename), a new dict for each caller.
- Link.upload_pass reads it once for a project's turn and hands it to the
  upload's fresh draw (dead and voided) and the host pass (host_sent);
  keep_host_sent reads it once.
- The host pass skips a host file whose _log_file_held key did not move
  and whose session writers' events are all at or below host_sent as it is
  now (HubLog.host_files); `again` walks every one.
- HubLog.is_own builds its set of names once per machine_identity tuple,
  which a renaming welcome replaces.
- desk() reads the plugin manifest by stat: a version bump alone restarts
  no uplink, so once a process would report a stale version.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…each log a generation

recorded_project (and last_project, same shape) walked every registered
project for each session whose directory the uplink may not read, opening
log/<name>.<session>.jsonl under every machine name and statting a missing
streams.json each time: 26 sessions x 101 projects x 1.65 names on the
MacBook every cache generation, nearly every open failing (the 10 s bursts,
22 % of the uplink's file calls).

- _holding_projects lists projects/ and each project's log/ once a cache
  generation (_log_listed, cleared with _RECORDED) and yields only the
  projects whose log holds a writer file of the session under its name now
  or a former one that held it, plain or an audience stream; no lstat of
  each project.json, since known_project reads it anyway.
- _writer_events, given the listing, opens only listed files and reads
  streams.json only once a stream file of the writer is listed.
- known_projects lists projects/ instead of globbing, in sorted(glob)'s
  order, without glob's lstat of every project.json.
- withheld asks getcwd only for a path inside a protected folder.
- words_due and reach_due read the shared merged log, so addressees'
  log_memo holds while no file moved; nothing they hand out is changed in
  place (the asks keep the events, the frames copy them, deliver_verdict,
  deliver_reach and words_unanswered read the log again).

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…st in TECH-DEBT

The doctrine paragraph of scripts/CLAUDE.md states what the upload pass
reads by stat and once, what one log listing a generation answers, and
what the host pass skips. TECH-DEBT's "sminos uplink idle cost" holds what
was left out on purpose (the second member publish, seats() per member
read, the whole own-writer look at each scan, Plane.tick's unconditional
forget, the host and outbox probes), each with its measured share and its
trigger, and what bench_scale.py lacks to reproduce the cost.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 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-11T09:14:05.947837Z 3833ff6 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.

…ed, never a kept listing

The generation's listings (_holding_projects) are filled by the first
session asked and reused for every later one, so a session's first
last_project lookup in a generation could miss a writer file or audience
stream made after the listing. While the statements are unknown,
_session_project takes that answer as the session's project and a
reconciliation can move it there (reviewer-high, P2).

last_project goes back to 1.46.0's read: the registrations globbed at the
call, known_project, _own_events with no listing. The listings stay
recorded_project's alone, whose answer is a Guessed nothing joins, moves or
retires on. The doctrine, the docstrings and TECH-DEBT say so; the
regression tests ask another session first in the generation, then write a
newer joined (plain, and in an audience stream) and require last_project to
answer the new project.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
@SSFSKIM
SSFSKIM merged commit c25bd7f into main Nov 12, 2026
12 checks passed
@SSFSKIM
SSFSKIM deleted the sminos-uplink-idle branch November 12, 2026 09:46
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