Repository navigation
sminos: Linux is a first-class sminos machine — daemon install writes a systemd user unit; a Resume's own job is never refused on Linux (Arkho #85, 7.159.0) - #203
Merged
Conversation
… a systemd user unit (Restart=always, KillMode=process, 0600, the stable CLI, the service env, daemon.out, lingering said), and launched_by reads a process's start off /proc to the tick, never the second before it (Arkho #85, 7.159.0)
… — ExecStart expands no variable in the program's path, as the live VM run showed
…e break, and print loginctl enable-linger with no user taken from LOGNAME (Arkho #85 review)
SSFSKIM
added a commit
that referenced
this pull request
Oct 16, 2026
#203 fixes the Linux start-time refusal at its source (sminos_rpc reads /proc). The stand-in's startedAt and the TECH-DEBT note about it go, so test_rpcs.py exercises that path. Version files take main's side; the bump follows.
3 of 5 tasks
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.
Arkho board ticket #85: a Linux machine is a first-class sminos machine.
sminos daemon installwrites a systemd user unit there, and the process-start check that refused a Resume's own--bgjob on Linux now reads the start precisely. Version 7.159.0, over main's 7.158.3 (main at5704255c).Problem
daemon installalways wrote~/Library/LaunchAgents/<label>.plistand printedlaunchctllines, whatever the OS. On Linux nothing reads that file, so a cloud devbox (the personal cloud env's Ubuntu machine) could not run the daemon as a service.launched_by(a Resume's "started no earlier than the launch") fell back tops -o lstartwhen the engine's record had nostartedAt. Linux's procps adds a process's offset to/proc/stat's boot time, which is truncated to the second, so a process can read up to a second before it started. Reproduced live: on the proof VM (boot instant 0.68 s pastbtime's second), main'stest_rpcs.pyfails 4 Resume cases with "job … took the session, but no process of it holds the session after 30 s".What this PR changes
sminos_daemon.service()): launchd on darwin, systemd on linux, a refusal elsewhere.SMINOS_SERVICE=launchd|systemdoverrides it, for tests. The macOS path renders the same plist and prints the same lines.skills/sminos/references/sminos-daemon.service, rendered into~/.config/systemd/user/sminos-daemon.service,$XDG_CONFIG_HOMEwhen set), under the launchd agent's contract:ExecStartrunsinstalled_cli()'s stable path (the marketplace clone from an installed plugin, never the versioned cache).launchd_env(), renamedservice_env()): SMINOS_HOME, PATH, DAEMON_HOST, the gateway route.write_private, now shared with the plist).daemon.out(StandardOutput=append:).Restart=always,RestartSec=10: the daemon's exit on new code restarts it.KillMode=process: a stop or restart signals the daemon alone, as launchd kills only the job's process group. The daemon stops its uplink itself. What it started in a session of its own (derive --all, and aclaude --bgfrom a spawn or Resume RPC together with the engine supervisor that may come up with it) runs on. Under the defaultcontrol-groupa plugin update would kill them.WantedBy=default.target, so lingering starts it at boot.unit_word: C escapes in a quoted word,%%). A registry path holding a line break is refused.systemctl --userload and unload lines andloginctl enable-linger, which a user can run without sudo on Ubuntu 24.04.sminos.proc_started_at):/proc/<pid>/stat's start ticks plus (now −/proc/uptime), within a clock tick of the true start.sminos_rpc.started_attakes the engine's record first, then this, thenps(on macOSpsfloors the precise start, so it is never a second early).same_processand the derivation's pid check are unchanged: they compare twopsreadings (the engine'sprocStartis itselfLC_ALL=C TZ=UTC ps -o lstart), with a 2 s tolerance or as the same reading twice.daemon installline and paragraph, and CLAUDE.md's sminos row, describe both platforms.The macOS-assumption sweep of
skills/sminos/scripts/sminos_daemon.pyinstall,own_code,cmd_runlaunchctl, KeepAlive)sminos_rpc.started_atps -o lstartas exact to the second/procfirstsminos.read_proc_start/same_process/ derive's pid checkps -o lstart"", so the start check is skipped there and the pid alone decides. Ubuntu server images ship procpssminos.boot_id,lib.sh _boot_idsysctl kern.boottime/proc/sys/kernel/random/boot_idis read firstsminoslauncherreadlink -fsminos_bridge.SOCKET_PATH_MAX = 103sun_pathsminos_control.supervisor_socket/tmp/cc-daemon-<uid>/<hash>/control.sockrPe()) uses/tmpon every POSIX platform but Termuxsminos_tui.pyflock,AF_UNIX,os.kill(pid, 0)Outside the sweep's scope,
skills/issue-tracker/still names launchd for the board runner. Not touched here.Alternatives considered
launched_by(started >= int(launched) - 1when onlypscan tell), relying on the job id. Rejected: it loosens the comparison on both platforms, while the precise reading fixes the measurement and leaves the comparison as it was.KillMode=control-group(the default) ormixed: both kill the daemon's detached children at every plugin update. Phase 6 below shows the difference on this systemd.RestartSec=60, launchd's ThrottleInterval: launchd restarts at once after a long run and throttles only a crash loop. systemd waits RestartSec after every exit. 10 s keeps a plugin update's gap short and a crash loop slow.Validation Evidence
tests/sminos/test_rpcs.pyon the proof VM (Ubuntu 24.04 arm64, boot instant 0.68 s pastbtime)startedAt)test_rpcs.py51 tests OK. All 1770 assertions at11922775; all 1774 at the head94916003python3 tests/sminos/test_rpcs.py LaunchStartproc_started_atstubbed out (the old code) the own-job case failsrun-sminos-tests.shSMINOS_SERVICE, and pass on both platforms. The systemd block checks the stable CLI, env and escaping, mode, Restart, KillMode, daemon.out, WantedBy, XDG_CONFIG_HOME, cache→clone, the line-break refusal and the linger line. Platform choice: the host's own (plist on Darwin, unit on Linux) and the three branchesscripts/lint-shell.sh tests/sminos/run-sminos-tests.shdoperpowers:reviewer-high, two roundsStandardOutput=append:, and the printedloginctl enable-linger <user>took LOGNAME unquoted. Both fixed with tests (393f6fe6). Round 2: "No material findings", verdict correctLive proof on a throwaway Ubuntu VM
Hetzner
cax11(ARM, the owner's devbox architecture),ubuntu-24.04, systemd 255, a login userdev. The plugin was laid out as the harness keeps it: a marketplace clone, the versioned cache, andknown_marketplaces.json. The install ran from the cache's CLI. The VM and its SSH key were created for this run and deleted after it.daemon installwrote the unit at 0600, itsExecStartthe marketplace clone's CLI, and printed the commands. Running them gaveactive (running), andsminos daemon statusreporteddaemon: running (pid …)./tmp/esc/dp 50%$xwith registry/tmp/esc/reg 100%$yand gateway values holding quotes, backslashes,%and$was started with a stub program. The stub received its path, its arguments and every value exactly, and wrote todaemon.outat the escaped path. The first try found that ExecStart does not expand$$in the program's path; fixed in6ff6db4a.apps/desk-hubat master,local/run.ts) ran on the VM as a user service.hub enroll(code on stdin) enrolled the running daemon, its uplink connected, andproject init --hubplussayput an event in the log. The hub showedarkho85-linux-daemononline: trueand the event at offset 1, sealed.loginctl enable-lingeras dev (no sudo) turned lingering on. After logout the daemon ran on under the same pid, and the hub saw it online.NRestarts=1), the uplink reconnected, and a new event went up.KillMode=processunit survived the unit's exit, restart and stop. Under the defaultcontrol-groupit was killed.sayreached the hub at offset 3, and the machine showed online.The run predates
393f6fe6, so its install output still printsloginctl enable-linger dev. The head printsloginctl enable-linger, which the VM showed acts on the caller.The run's transcript
Residue
launched_bystill compares the engine'sstartedAtfirst. Whether that is the job's claim time or a pre-started spare's process start is C-series closeout: substrate gateway-env scrub, worker-host upgrade note, review-bench round 2, roadmap retrospective (v7.63.0) #84's live Resume question, not this ticket's.startedAttofake_claude.py's records as the workaround for this defect, which would hide the/procfallback fromtest_rpcs.pyagain. If ci: adopt ci-kit — PR checks per suite family; sminos and codex-companion timing tests made event-driven (ci-kit M3) #198 lands first, the merge of main here should drop that line (and its TECH-DEBT note), since this PR makes it unnecessary.