Repository navigation
Conversation
There was a problem hiding this comment.
Approve with nits (3 P2, 1 P3)
Scope: base main, merge base 53f7d21a; 1 commit, 5 files reviewed at a71a2707. Loaded coderbook, ponytail-review, karpathy-guidelines. Ran in a separate session.
Findings
P2
-
Systemd fallback is decided by matching stderr prose —
apps/computer/local-daemon/internal/linger/localtools/local_linux.py:662(_SYSTEMD_UNAVAILABLE_MARKERS), used inlaunch().
The repo rule forbids driving behavior from third-party error wording. It also misfires here. Withsystemd-run --scope, systemd-run execs the target in place, so the stderr read back and the exit code belong to the application, not only to systemd-run. Example: an app (orxdg-open/gio) prints the common D-Bus warningFailed to connect to bus: ...and exits non-zero within 0.8 s._is_systemd_unavailablethen matches, and the same app is launched a second time outside a scope. The error the user sees comes from the second attempt.
Fix: decide before launching, with a check that doesn't depend on wording. For example, use the scope path only when the user manager is reachable ($XDG_RUNTIME_DIR/systemd/privateexists, orsystemctl --user is-system-runningreturns a status). On a scope failure, report the error and don't retry. -
Owning README still describes the old launch design —
apps/computer/local-daemon/README.md:1051-1063.
It still says the host needs a user systemd manager and that launches usesystemd-run --userwithKillMode=process. It also saysopen_urlonly fails after 8 s. After this PR, launches run in anapp.slicescope, fall back to a detachedPopenwithout systemd (andprobeno longer requiressystemd-run), and an immediate non-zero exit fails fast as a confirmed (not unknown-outcome) error, withlaunch-errordiagnostics added to the timeout. AGENTS.md asks for the owning docs to change in the same PR. -
New Python unit tests are never run —
apps/computer/local-daemon/internal/linger/localtools/local_linux_test.py.
The onlyunittestinvocation in the repo isMakefile:139(apps/desktop/packaging). No make target,scripts/check-plan.mjsentry or workflow runs these 513 lines. The parsing, journald, settle and fallback logic they cover can regress without any check failing. Add them tomake check-computer(or the existing unittest step) socheck (computer-go)runs them.
P3
- Two parallel stderr sinks —
local_linux.py:721-800(_open_journal_stream,_query_journal_raw,_read_journal_stderr,_journal_sink_available,_open_stderr_sink).
The hand-written sd_journal stream header, the readback probe with retries, the journalctl polling and theTemporaryFilefallback are two ways to do one job, about 150 lines plus a mock AF_UNIX server in tests. Consider whether one sink is enough. For example, keep only the unlinked temp file; the driver already closes it on the next launch or on exit. Or keep only journald and drop the file path.
Verified as fine
- The driver still runs as
python3 -u -c <program>(linux_native.go:42), so the newif __name__ == "__main__":block runs and the stdout dup/signal handlers are set up as before. status: "failed"fromLaunchErrorreaches Go as a plain error, noterrOutcomeUnknown:linuxActiononly wrapsstatus == "unknown"and returnsreceipt.Errordirectly (linux_native.go:80-88). So the action journal is not blocked.launch-erroris added to the read-only set (linux_native.go:56), so a failed diagnostic read never turns into an unknown-outcome input.launchFailure(linux.go:469) keeps the oldopenbehavior (it always returnserrURLNotOpened, now with detail). Forrun, it errors only when the driver reports a real detail, so a slow app still returnswindow_opened: falseas before (linux.go:220-226,244-250).launch_errorreads nothing while the process is still running (proc.poll() is None), so startup noise from a slow cold start can't fail a launch.- A failed first spawn closes its stderr file before the fallback spawn (
_spawn_and_settle). The previous launch's file is closed on the next launch, on exit and on SIGTERM (_close_last_launch). xdg-openpresence is checked before input begins inopen, sinceprobeno longer requires it.- No CJK in added lines or in the commit message.
Process notes
- The branch is 10 commits behind
main, andmainrequires up-to-date branches, so it needs a rebase. - Commit
a71a2707is authored byengineer@simplexai.com, which isn't linked to a GitHub account. - No merge or fixup commits.
CI
All checks that ran pass (check (computer-go), check (computer-go-windows), check (desktop), repository-gate, CodeQL); the rest were skipped by path. CI doesn't run local_linux_test.py (see finding 3) and runs Go tests without -race. Locally: python3 -m unittest local_linux_test → 15/15 OK; go test -race -count=1 -run TestLinux ./internal/linger/localtools/ → ok.
Automated review by Claude Code
Automated review of a71a270 by Claude Code.
a71a270 to
8b0a3ff
Compare
8b0a3ff to
1b50d9c
Compare
There was a problem hiding this comment.
Approve (0 findings)
Scope: follow-up review of 1b50d9c against main (merge base 19cdc336), 1 commit, 7 files. The previous review was on a71a270; the branch has been rebased since then, so I compared the two merge-base diffs and also re-read the whole PR. Helper skills loaded: coderbook. ponytail-review and karpathy-guidelines were not loaded; I applied their checklists from the review instructions. This review ran in a separate session.
Previous findings (follow-up on a71a270)
- P2: systemd unavailability was detected by matching stderr prose. Resolved.
_SYSTEMD_UNAVAILABLE_MARKERSis gone.launch()now chooses the scope or a direct launch once, up front, through_systemd_user_reachable(local_linux.py:804):systemd-runonPATH,$XDG_RUNTIME_DIR/systemd/privateis a socket, andNameHasOwner("org.freedesktop.systemd1")withNO_AUTO_START. A non-zero exit is never retried (local_linux.py:940-945).test_launch_skips_systemd_when_user_manager_unreachable_and_never_retries_on_stderr_prose(local_linux_test.py:247) asserts that an app printing "Failed to connect to bus" runs exactly once. - P2: README described the old
.servicelaunch. Resolved.apps/computer/local-daemon/README.md:1063-1083now describes the scope underapp.slice, the detached fallback, and the fast launch-error surfacing.systemd-runis no longer listed as a hard dependency, which matches the probe that no longer requires it (local_linux.py,native_action("probe")). - P2: the new Python tests did not run anywhere. Resolved.
Makefile:149addspython3 -m unittest discovertocheck-computer-go. Thecheck (computer-go)job log showsRan 15 tests ... OK. - P3: two stderr collection paths. Partially resolved. The code is trimmed (single-expression helpers,
withfor the probe socket), but both the journald stream and theTemporaryFilefallback remain. The reason (no/tmpgrowth on systemd hosts, portability elsewhere) is now documented in the_open_stderr_sinkdocstring (local_linux.py:871). This is acceptable as a deliberate trade-off.
Findings
None.
Verified as fine
- The embedded driver still runs its server loop. Go starts it with
python3 -u -c <program>(linux_native.go:43), so__name__ == "__main__"and the moved fd and signal setup run as before (local_linux.py:1116-1121). Importing the module in tests no longer hijacks stdout or the signal handlers. - A confirmed launch failure is not recorded as an unknown input outcome.
LaunchErrorreplies withstatus: "failed"(local_linux.py:1105). InlinuxAction, a non-emptyErrorwith a status other thanunknownreturns a plain error, noterrOutcomeUnknown(linux_native.go:85-91), so the action journal is not blocked. launch-erroris classed as read-only inlinuxAction(linux_native.go:56), so querying it never turns a failure into an unknown outcome.launchFailure(linux.go:469) keeps the oldopenbehaviour: it still returnserrURLNotOpenedand dropswindow_opened, now with any detail appended.run(open_application) fails only when the exited process left a non-zero status or stderr.launch_errorreturns""while the process is still running (local_linux.py:956-975), so a slow cold start keepswindow_opened: falsewithout an error (TestLinuxOpenApplicationSlowRunningAppPreservesWindowOpenedFalse).- In
runActions, arunstep with no window and no launch error still continues as before, and anopenstep still stops witherrURLNotOpened(linux.go:220-226). - Child processes are not left as zombies: a still-running child is reaped by a daemon thread calling
proc.wait(local_linux.py:927-931). The journald socket is closed in the parent right after spawn. The temp-file sink is closed on the next launch and on driver exit (_close_last_launchinexit_driverandstop_driver). - If
giis missing,_systemd_user_bus_has_ownerreturns False (local_linux.py:784). That host already failscheck_permissionson the missing AT-SPI import (local_linux.py:492-497), so the direct-launch fallback there changes nothing reachable. - The
isLocalLinuxtest seam is restored int.Cleanup, and no test inlinux_launch_test.gousest.Parallel, so the shared package variable is not raced. - No CJK in added lines or in the commit message. No stale
KillModeorlinger-app-*.servicereferences remain outside test fixtures that reproduce the old error text.
Process notes
- The branch is one commit behind
main(4ef3f8f7, which only touchesapps/computer/local-daemon/README.mdin a different section).mainrequires up-to-date branches, so rebase before merging. - The commit author
Linger Engineer <engineer@simplexai.com>is not linked to a GitHub account.
CI
All checks pass, including check (computer-go), which ran the 15 new Python tests, and check (computer-go-windows). CI runs the Go tests without -race. This PR adds no goroutine concurrency in Go, so I did not run any tests locally.
Automated review by Claude Code
Automated review of 1b50d9c by Claude Code.
…h errors (WHI-1047) Switch local_linux.py launch() from systemd-run --service-type=exec (transient .service unit with stripped environment) to a transient .scope unit under app.slice (app-linger-<uuid>.scope) when the user systemd manager is reachable, preserving the session environment and populating XDG_RUNTIME_DIR/DBUS_SESSION_BUS_ADDRESS defaults so Snap apps (such as Ubuntu's Snap Firefox) can create their own tracking scope without .service cgroup rejections. Probe user systemd reachability before launching via structured signals (systemd-run in PATH, runtime_dir/systemd/private socket, and D-Bus NameHasOwner for org.freedesktop.systemd1 with NO_AUTO_START and a 300 ms timeout) instead of matching stderr prose. Fall back cleanly to direct detached Popen(start_new_session=True) when unreachable, and fail directly without retrying when a systemd-scoped launch exits non-zero. Route launched process stderr to systemd-journald's native stdout stream socket (/run/systemd/journal/stdout) once journalctl --user readback is verified (avoiding unbounded unlinked /tmp growth on long-lived GUI apps without SIGPIPE, SIG_IGN leaks, or relay processes), falling back to an unlinked TemporaryFile when journald is unavailable or unreadable. Monitor startup during a bounded settle window so immediate non-zero exits surface as confirmed failures without blocking the action journal or waiting 8 s for errURLNotOpened, filter benign ld.so.preload noise before truncation, and only inspect post-settle stderr in launch-error once the process has exited. Update local-daemon README to document the new Linux launch behavior and wire local_linux_test.py into Makefile check-computer-go so both local check-computer and CI run it.
1b50d9c to
d928a3f
Compare
There was a problem hiding this comment.
Approve (0 findings)
Follow-up on 1b50d9c. Merge base 6a511c15; 1 commit and 7 files reviewed. git range-diff shows the only change since the previous review is a rebase onto main. The only line that differs is the Makefile context line, which now includes ./cmd/linger-teamhub-launcher from main. I still re-checked the full merge-base diff.
Verified as fine
- A
LaunchErrormakes the driver replystatus: "failed"(local_linux.py:1104-1108).linuxActionreturnsreceipt.Erroras a plain error before it reaches the unknown-outcome path (linux_native.go:91-92). A confirmed launch failure therefore doesn't block the action journal.launch-erroris in the read-only list (linux_native.go:55). - The
__main__guard still runs the server underpython3 -u -c(linux_native.go:42), because-csets__name__to"__main__".Gio/GLibcome from the guarded import atlocal_linux.py:492, and_systemd_user_bus_has_ownerreturns False when they are missing (local_linux.py:784). openstill always fails when no window opens:launchFailurereturnserrURLNotOpenedwith or without detail (linux.go:472-479).runfails only when the driver reports exit detail, so the earlier no-windowrunbehavior is unchanged (linux.go:480-486).
Process notes
- The commit author
Linger Engineer <engineer@simplexai.com>is not linked to a GitHub account.
CI: Analyze, changes and repository-gate are still pending. I ran these locally and both passed:
python3 -m unittest discover ... -p '*_test.py': 15 tests OK.go test -race -count=1 -run 'Launch|Linux' ./internal/linger/localtools.
Automated review by Claude Code
Automated review of d928a3f by Claude Code.
Summary
Fixes WHI-1047 (Linux
launch()using a transient systemd.servicethat strips session env and swallows launch failures behind an 8-second generic timeout).Root Cause
local_linux.py:launch()wrappedxdg-openandopen_applicationinsystemd-run --user --service-type=exec --unit=linger-app-<uuid>, stripping caller env (missingXDG_RUNTIME_DIRand desktop vars) and returning exit code0onexecvebeforexdg-open/snap-confinefailed withstatus=4/NOPERMISSION.linux.go) saw confirmed launch success and waited 8 seconds before returning genericerrURLNotOpenedwith zero diagnostic context.Changes
apps/computer/local-daemon/internal/linger/localtools/local_linux.py:launch()tosystemd-run --user --scope --quiet --collect --slice=app.slice --unit=app-linger-<uuid>.scopewithstart_new_session=True, preserving full caller session env +XDG_RUNTIME_DIR/DBUS_SESSION_BUS_ADDRESSdefaults._systemd_user_reachable(env)(systemd-runonPATH,$XDG_RUNTIME_DIR/systemd/privatesocket, andorg.freedesktop.DBus.NameHasOwner("org.freedesktop.systemd1")over session D-Bus viaGiowithNO_AUTO_STARTand 300ms timeout). When reachable, runs.scopedirectly and never retries on app stderr; when unreachable (containers or broken user buses), launches directly via detachedPopen(..., start_new_session=True)./run/systemd/journal/stdoutstream sockets (with a one-timejournalctl --userreadback probe) as childstderron systemd hosts—avoiding unbounded unlinked/tmpgrowth for long-lived GUI apps, avoidingSIGPIPE, and never leakingSIGPIPE=SIG_IGNtognome-terminal—with clean fallback to unlinkedtempfile.TemporaryFile()on non-systemd/container/Storage=nonehosts.launch-errordiagnostics (""whileproc.poll() is None) and pre-truncation filtering of benignERROR: ld.so: object ... cannot be preloadednoise.apps/computer/local-daemon/internal/linger/localtools/linux.go&linux_native.go:launch-errorwhenwindow_opened == falseto enricherrURLNotOpenedand surface post-settle crashes onopen_application.apps/computer/local-daemon/README.md&Makefile:.scope, reachability-gated fallback, and fast launch-error surfacing.python3 -m unittest discover -s apps/computer/local-daemon/internal/linger/localtools -p '*_test.py'intocheck-computer-go(make check-computer& CI).local_linux_test.py&linux_launch_test.go: 15 Python unit tests and Go launch/embedded-driver tests.Review Updates
org.freedesktop.systemd1NameHasOwner+ socket reachability, removed_SYSTEMD_UNAVAILABLE_MARKERSstderr-text matching), P2-2 (README updated), P2-3 (Makefilecheck-computer-goruns Python tests), P3-4 (trimmed verbosity, zero issue IDs in code comments; kept both journald stream andTemporaryFilefallback to satisfy zero/tmpgrowth on systemd hosts and portability on containers/macOS), and rebased onto latestmain(29ad855e).Verification
11/11in Linux container),go vet, andGOOS=linux GOARCH=amd64cross-compile all PASS.118: snap Firefox cold/warm launch and non-systemd fallback under structured reachability check.linux_native.gowith a 1-line test seam alongside PR fix(computer): guard Linux type_text and press_key against GNOME Overview and empty active window (WHI-1046) #778; whichever merges second will have a trivial 1-line conflict to unify.