Repository navigation
feat(op): the in-process broker: the caller through pkg/process, root through one sudo -n, the platform and the shell provider through it - #1143
Merged
Conversation
…r through pkg/process, root through one sudo -n; op.Run collects an exec (#1130) pkg/op/broker_stub.go is the Broker that lives in the app's process and forks commands from it: the direct path of 2.7 for the caller's own account, kept; sudo -n in front of a root exec, the one place the word appears in pkg, retired in iteration 3; any other account a named Refusal; Post refused until plan.logon. Frames reach the console as the child speaks, through process.Runner.Stream, the relay with callbacks that keeps dry-run and the audit line. op.Run subscribes, execs and collects until the control frame. The runtime environment carries a Broker, the in-process one by default, a RecordingBroker through the spec in tests. The per-run stream moves to broker_stream.go, shared with the double. The plan is approved, Phases 1 and 2 ticked, its two departures noted.
…ery call names its account, and runCommand's sudo is gone (#1130) pkg/platform takes its runner through Spec.WithCommandRunner; New hands it to every leaf and the service manager through the commander they embed, and defaults to LocalRunner, which stands for the caller alone. Seventy call sites say AccountRoot or AccountCaller where a boolean said sudo; runCommand and helpers_unix.go are deleted, and `grep -rn sudo pkg/platform` finds nothing. apt declares DEBIAN_FRONTEND=noninteractive once, where it belongs. op.PlatformRunner is the adapter the runtime environment builds its detected platform with, after its broker exists: each manager command is an exec through the broker, folded back into the platform's Result. The double gains Complete, for a caller that waits and does not care what the command said. runWindowsCommand is named as 6.2 § 10's interim row until lane 8. The plan's Phase 3 box is ticked with its two departures and the one visible change.
…ent's broker, a caller script of dialect sh (#1130) Exec is op.Run of an ExecRequest: the body the command, written to a file and run by sh, never a string to -c; the result folds back from the frames, stderr the narration lines. Two tests prove the request's shape through a RecordingBroker and that a refusal is the error with no result. The plan's Phase 4 box is ticked.
…here no leaf calls it until lane 8 (#1130)
…ss, and a killed child's abandoned pipes no longer hang the broker (#1130) The race detector, which CI's test job runs and I had not, found Cancel reading child.Process while Start wrote it on the run goroutine; each exec now has a context of its own, Cancel cancels it, and the child is the run goroutine's alone. dash forks `sleep` where bash execs it, so a kill left an orphan holding stdout and Wait blocked until it exited; WaitDelay bounds that wait, and the cancel test runs `sleep 30; true` so every sh forks. The platform-wiring test skips on Windows, whose leaves reach the runner at lane 8.
1 task done
David-Noble-at-work
added a commit
that referenced
this pull request
Oct 23, 2026
…erge (#1145) ## Summary - **Plan 1130 is `complete`.** Phase 6 after #1143's merge: `make install`, `writ --version` reporting 65ee707; `writ deploy` from an unprivileged shell on Media-Server, 279 links, every one resolving. One status line and one tick, nothing else. ## Test plan - [x] The quality gate passes; the file is Markdown Resolves #1130. Written with AI assistance. Signed-off-by: David Noble <[email protected]> Assisted-by: Claude Code
This was referenced Oct 24, 2026
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.
Summary
Lane 2 of schedule #1127: the broker in the app's process, behind the interface #1140 landed.
op.InProcessBroker,pkg/op/broker_stub.go: aBrokerthat forks commands from the app's process. The caller's account runs throughpkg/process, the direct path of 2.7, kept; root runs through onesudo -n, the only place the word now exists inpkg, retired in iteration 3; any other account is a namedRefusal;Postis refused until the logon lane. Frames reach the console as the child speaks, throughprocess.Runner.Stream, the relay with callbacks;Cancelkills the child;Trackis the run registryCommandandStatusanswer from.op.Runis the synchronous collect every provider needs. The runtime environment carries aBroker, the in-process one by default.pkg/platformtakes aCommandRunnerthrough its spec;Newhands it to every leaf and the service manager through thecommanderthey embed. Seventy call sites sayrootorcallerwhere a boolean said sudo;runCommandandhelpers_unix.goare deleted;grep -rn sudo pkg/platformfinds nothing.LocalRunneris the default for a platform built outside a runtime environment, the caller alone.op.PlatformRunneris the broker's adapter the environment builds its detected platform with.sh, never a string to-c. The pkg and service providers change nothing and now run through the broker by way of their platform.docs/plans/task/1130-in-process-stub.mdisactive: Phase 6 after the merge ismake installand awrit deployfrom an unprivileged shell on Media-Server.Two things to judge: every manager command now narrates its audit line,
$ brew info foo, through the process runner, where the old runner printed nothing; and frames are live from this lane, which leaves #1131 the never-dropping spool and the event sink.Test plan
make checkpasses: the quality gate and every test, on the committed treepkg/op,pkg/platformand the shell provider: the three accounts, the script tier with an injection attempt that arrives as text, stdin, env and cwd, auto-confirm, dry-run, cancel, a launch failure, the adapter's fold intoplatform.Result, the leaves' accounts on refresh, the shell provider's request shape and refusalFor #1130, which closes when Phase 6 converges the machine.
Written with AI assistance.
Signed-off-by: David Noble [email protected]
Assisted-by: Claude Code
Time
Computed by the algorithm of noblefactor-ops#188 at merge.