Skip to content

Epic: Authorization #520

Open
0 of 2 issues completed
Open

Description

@David-Noble-at-work

Spec: the draft devlore_authorization_specification.md of 2026-10-16 (in the owner's hands, not yet in the tree) supersedes 6.1-privilege-elevation.md; it lands as 6.1-authorization.md with a status companion through #1116's first task. Neighbours: 6 owns the policy triplet, 6.2 the execution hosts, 6.3 the form of a command, 2.6 the per-unit requirement's place, 2.7 the wire.

Ruled 2026-10-21

  • The term is authorization: what a unit requires and a broker grants. Running a process under an account other than the caller's is one case of it, an elevation, which guarantees access to a command runner standing for that account. authz replaces elevation and elevator as the provider package name. The elevator stub is dead and is removed (elevator is removed: the stub is dead, and its rename plan is withdrawn #679). This epic's label is Epic:Authorization, renamed from Epic:ElevationPolicy.
  • Enums are strings, for readability. The draft's int constants are replaced; the empty string is the zero value and means defer.
  • There is no "whether". A command runner stands for one account, root or not, and runs many commands under it. The pkg installers are augmented to obtain the runner they need. NeedsSudo() becomes "which account"; runCommand(argv, sudo bool) goes.
  • The execution model is a pool of command-runner daemons, one per account, all the same binary, holding no shell: every command is a fresh child, by argv or by sh on a static script file (6.3). A runner runs many commands at once and pumps each child's fds without blocking it. Calls may be brokered through a broker daemon that authenticates the socket's peer, authorizes the account and routes, or go direct to the caller's own runner. Local transport is a Unix domain socket or a Windows named pipe; remote is TLS; HTTP/2 (ruled against HTTP/3 the same day: the local leg cannot carry QUIC, Go has no standard-library HTTP/3, and the frame design needs no cross-stream order). Outputs, narration, events and exit status reach the originator as tagged, seq-numbered frames on the run's open event stream; commands go up on their own stream (2.7). Narration becomes a wire channel, the one change to 2.7.

The substrates

Three, as the draft has them. Command execution: the runners, and the sudo -n sites in pkg/platform that become runner calls (#527). Network and service access: tokens bridged to appnet and, first, the broker's own remote API. Sandboxed agent execution: sbx, of which nothing exists in the tree.

Features and chores

Kind Issue What it is now
feature #1116 The authz provider, under #815 by the 2026-09-05 ruling that every provider is a feature there; its design, types, broker and first tasks
feature #521 Reconcile the spec with the settled config and broker models. The draft is that reconciliation; #522–#525 are its four "resolved decisions" and close against the adopted spec, with the corrections #1116 lists
feature #526 Give the dormant plumbing a consumer: #527 routes pkg/platform's sudo through the runner; #528, the JEA spike, may dissolve under the daemon model, since a Windows service can start a process under another account headless (unverified on a host)
chore #679 elevator is removed; its rename plan is withdrawn

Ordering and dependencies

  • Epic: Rename op to workflow, then partition it #451 (op → workflow) owns a serial window under pkg/op/; whether authz and the runners land before or after it is open (question 2 of the gap analysis below).
  • Epic: The Command Runner #442 (execution topology) owns the runner pool and the broker; 6.2 is to absorb document 6's § Approach, § Interface Shape and § Remote Execution onto the account axis and the daemon model.
  • David-Noble-at-work/personal#288, the System tree, and its first task personal#289 depend on this epic: a System/ deploy from an unprivileged shell needs the runner standing for root.

The record

The gap analysis of 2026-10-21, with its twenty gaps, eighteen design questions and the rulings so far, is the first comment below until the design document issue carries it into docs/.

Plan and design documents

Kind Document
Plan docs/plans/extract-starlark-from-op/phase-8/steps/38-elevation-policy.md

Sub-issues

Sub-issues

0 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. changed the title [-]Epic: Elevation policy[/-] [+]Epic: Authorization[/+] on Oct 21, 2026
  2. David-Noble-at-work commented on Oct 21, 2026

    @David-Noble-at-work
    ContributorAuthor

    Gap analysis and design questions, 2026-10-21. The draft devlore_authorization_specification.md reconciled with the tree at develop 45a0dd43. Rulings taken in session are marked in place; § 8.1 adds the return path for a command's output and narration, § 8.2 how narration is buffered apart from output, § 8.3 the fork at the control plane (telemetry to the logger, narration and output to the caller), which corrects § 8 and § 8.1. This comment is the record until the design document issue carries it into docs/; the drawing it refers to is the owner's artifact "writ and the Runner Daemon".


    authz: the draft reconciled with what the tree holds

    Gap analysis and design questions for the owner's ruling. Source draft: /Users/david-noble/Downloads/devlore_authorization_specification.md, 2026-10-16 15:22, 437 lines. Compared against devlore-cli develop at 45a0dd43 (2026-10-21): 6.1-privilege-elevation.md and its status, 6-execution-topology.md, 6.2-process-pool.md, 2.6-execution-policies.md, 3.2-projected-provider-api.md § Pluggable brokers, configuration.md, step 38, the rename plan elevation-provider-rename.md, and the open issues under epics #520, #442, #530, #451 and #815. Each row says how it is known: D from a design document, C from the code inventory, I from an issue.

    1. What the draft keeps, and what the tree already agrees with

    Draft says Tree says Verdict
    Three-way split: graph carries a named offer, config carries the realization, runtime holds the router 6.1 settled the split (status box ticked); 6 § per-unit triplet carries it the old way Agreed. D
    Broker interface {Type, Acquire, Revoke}; provider-owned router built from the resolved config; no global registry 3.2 § Pluggable brokers: minimal mint/revoke contract, router allocates sub-brokers from its config node, no RegisterDriver Agreed, with one omission: 3.2 says the router is itself a broker and the pattern is recursive; the draft's brokerRouter is an unexported field and does not say it implements Broker. D
    Preflight refuses a graph whose offer ids are not configured; acquisition failure routes to ErrorAction; revocation failure to flow.Degraded / FailedCompensation 6.1 § Failure routing, identical three cases Agreed. D
    Secretless signed graph; broker definitions in config, credentials from the host's ambient chain 6.1 § Secretless; graph-signing plan Agreed. D
    flow.Provider.Elevate() removed; the elevator package deleted; one package is the home flow.Provider has no Elevate at all today (Choose, Gather, Subgraph, WaitUntil, Complete, Degraded, Failed); the draft's and 6.1's citation flow/provider.go:507 is stale. #679 keeps the elevator stub as step 38's scaffold Half moot, half conflict: nothing to remove from flow; and #679 rules the stub stays and is renamed where the draft deletes it. C, I
    "Resolved design decisions" 1-4: name, router, per-unit representation, one realization surface #521's tasks #522-#525 are exactly those four questions, all open The draft closes #522-#525 if adopted; they should close against it, not stay open beside it. I

    2. Gaps: what the draft wants that the tree does not have, or has differently

    # Gap Draft Tree How known
    G1 The name. Four were on record. Ruled 2026-10-21, question 1. authorization.Provider, package authorization code elevator; 6.1 and #679 elevation. Now: the term is authorization, the package is authz, elevation is the process-running case of it ruling
    G2 A third substrate. sandboxed agent execution (Docker sbx microVMs, model and MCP endpoints, cloud targets, host-boundary bridge) 6.1 and #520 name two substrates; nothing in the tree knows sbx D, I, C
    G3 Enum representation. Ruled 2026-10-21, question 3: strings. AuthorizationStrategy and GrantKind as explicit int constants, 0 reserved for None; replaced 6 § Target design, finesse 1: "String enums, not iota ints", matching BackoffStrategy; the shipped op.ElevationStrategy is a string enum; the empty string is the zero value meaning defer-to-default D, C
    G4 The whether. Ruled 2026-10-21, question 4: replaced by the command runner under an account, § 5. no disposition; a unit either references an offer or is implicitly host-escalated 6 names Mode (Auto / Required / Forbidden) as the missing "whether", needed for brew and the language managers that must never elevate; 2.6 says whether elevation is needed is partly resolved at execution time against the host's manager D
    G5 Where the fallback chain lives. fallback_strategies on the configured offer 6: Fallback *Policy on the unit, chained; the draft's per-unit requirement has no fallback D
    G6 The ProcessSpawn mechanism. Filled by rulings 1 and 4, question 6. a persistent privileged child worker {Start, Exec, WriteFile, Stop}, one per phase, IPC over a pipe — §6's old mechanism, cited as "Designed in §6" 6.2 supersedes it: privilege is an axis of execution-host identity in a lazily allocated pool; persistent privilege is an elevated parent forking a fresh child per request, multiplexed with request ids; #442's epic text says the same. The host-escalation broker should acquire a host identity from the pool, not run its own worker D, I
    G7 Config path. authorization: as a top-level section with offers and brokers configuration.md addresses provider config as providers.<name>.brokers... (its own example: profiles.release.providers.elevation.brokers.ssh.default_ttl); the sketch ProviderConfig{..., Brokers devconfig.ConfigBase} matches the draft's shape, the path does not D
    G8 Config foundation. ProviderConfig embeds config.ConfigBase, resolved through the profile tree pkg/devconfig is still the flat Config{sections map[string]Section}; no ConfigBase, no Path(), no loader, no overlay. The pattern that exists is op.PoliciesConfig: init()-time AnnounceSection, embed devconfig.SectionBase, a typed accessor. No provider package uses devconfig at all, and encryption.ProviderConfig, the draft's naming precedent, does not exist as a type C, D
    G9 Vocabulary. Graph, Subgraph, RecoveryStack, ExecutableUnit, GraphExecutor #451 renames them Definition, Block, Ledger, Node, Executor, in a serial window that conflicts with any in-flight branch under pkg/op/; pkg/op/provider/authorization is under it I
    G10 Authoring surface. an authorize action node with offer_reference_id, requested_ttl_seconds, scope, required_context_assertions ElevationOffer is Go-spec only: WithElevationOffer exists on every spec and nothing calls it, nothing reads ElevationOffer(), it is not serialized, and starlarkbridge/runtime.go skips "elevation while it stays dormant" in silence. #856 is the plan.* surface feature; nothing lets a Starlark author declare an offer reference C, D, I
    G11 Grant by value. AuthorizationGrant "pass-by-value, node-owned, memory-zeroed, zero shared state", carrying Value, MaskedVars and Headers maps with json:"-" an edge exists only for a PromiseBinding, and a promise resolves through RecoveryStack.ResultByUnitID: a producer's result is retained on the stack by unit id, so a grant returned as a result lives in shared, committed state until the stack unwinds. That is the opposite of the draft's security property. A struct holding maps is not by-value in Go either, and json:"-" only keeps the fields out of the codec, not out of the stack C, D
    G12 How a consumer takes a grant. "any provider method ... can be passed an AuthorizationGrant"; appnet.Download attaches headers the action taxonomy has no slot type for it; framework-read slots are a fixed list (claim, on_missing in framework_slots.go); #803 says the taxonomy has no error-only signature and no immediate-mode marker, so signature changes are open C, I
    G13 Windows. runas / UAC as a ProcessSpawn backend, in passing the only Windows elevation in the tree is runWindowsCommand(command, elevated) using Start-Process -Verb RunAs, which is the UAC consent dialog: interactive by construction. #528, the JEA spike on whether headless Windows elevation exists at all, is open and gating #442 C, I
    G14 Lease on sudo. Filled by ruling 4, question 14. AuthorizationLease.RevokeHandle is "worker PID/session"; compensation revokes "cached sudo timestamps" what revoking a sudo grant means is unstated: sudo -K, or releasing the pooled host; 6.2 drains hosts per run after compensation D
    G15 The interactive strategies in a headless run. InteractiveChallenge and MandatedApproval pause the unit with ErrPaused writ deploy of a System tree runs from a script with no tty on a remote host; what a paused deploy does there is unstated D
    G16 Audit into the receipt. every grant and revocation "threaded into the signed execution receipt" receipt signing is a plan (graph-signing.md), not landed as far as the documents say D
    G18 Action signatures and the receipt. Authorize(req OfferRequest) (AuthorizationGrant, *AuthorizationLease, error) and CompensateAuthorize(lease); the lease is "registered with the graph's compensation stack" every provider action is X(activationRecord *op.ActivationRecord, …) (Product, *Receipt, error) paired with CompensateX(activationRecord, *Receipt); the executor commits and pushes the receipt (GraphExecutor.pushAuditReceipt), the provider does not register anything. The lease is therefore a Receipt sealed through ReceiptBase, not a separate registration, and the draft's signatures lack the activation record, as the stub's do today C
    G19 Stale citations. pkg/op/authorization_policy.go; pkg/platform/helpers.go:77 and runShellCommand; flow/provider.go:507; elevator/broker.go:14 and :53 the file is pkg/op/elevation_policy.go; the function is runCommand in helpers_unix.go:58 with the TODO at :70-71; flow has no Elevate; the broker file's types are at other lines. The draft was written against 6.1's text, not the tree C
    G20 Where preflight goes. one preflight that cross-checks every offer id against the resolved config two passes exist: op.ValidateGraph at plan and load time (structural, no config in hand) and GraphExecutor.Run's preflight (catalog, runtime environment, variables, resources; fails with ReasonPreflightFailed). The offer-id check needs the resolved config, so it belongs in the run-time pass; a graph-only check (every referenced offer is declared on some unit) can sit in ValidateGraph C
    G17 The default host-escalation offer, and writ. implicit NeedsSudo() resolves against "a default host-escalation offer in the active profile" nothing calls NeedsSudo(); the sudo decision is a literal true at every call site (apt, dnf, pacman, systemctl, snap, port, system launchctl) into runCommand(argv, sudo). And writ deploy has no elevation of any kind: BuildGraphs builds one graph per scope, the System root is /, and no WithElevationOffer, sudo or euid check exists anywhere under cmd/writ. A System tree deploys today only if writ itself runs as root. This is the precondition personal#289 names C, I

    3. Design questions, in the order they block each other

    1. The name, and its reach. Ruled 2026-10-21. "authorization" is the term: the thing a unit requires and a broker grants. In one case, running a process, an authorization is an elevation, which guarantees access to an elevated process runner. authz replaces elevation and elevator as the provider package name: pkg/op/provider/authz, authz.Provider, authz.ProviderConfig, authz.Broker. The elevator is dead and can be removed or replaced at any time. Follows from it, as this document reads the ruling: the design document is 6.1-authorization.md with companion 6.1-authorization.status.md, as the draft already names them; the config section and Starlark module are authz; Epic: Authorization #520's label becomes Epic:Authorization; the draft's "Names — settled" block is rewritten from authorization.Provider to authz.Provider; and G6 is half answered: an elevation is access to an elevated runner, which is the pool's elevated host identity, not a worker the broker owns.
    2. Before or after the workflow rename (Epic: Rename op to workflow, then partition it #451)? Written in today's words and renamed by Epic: Rename op to workflow, then partition it #451's sweep, or written after Epic: Rename op to workflow, then partition it #451 lands in its words. Epic: Rename op to workflow, then partition it #451 owns a serial window under pkg/op/; a new package there during the window conflicts irreparably by the epic's own text.
    3. Strings or ints for the enums? Ruled 2026-10-21: strings, for readability. The draft's AuthorizationStrategy and GrantKind int constants are replaced by string enums in the form document 6 gives: the empty string is the zero value and means defer to default, so there is no reserved None constant. process_spawn, identity_assumption, interactive_challenge, mandated_approval; process_session, bearer_token, credential_env, approval_ticket.
    4. Where does the whether live? Ruled 2026-10-21: nowhere, because the question dissolves. There is an API for acquiring access to a command runner, a sidecar that runs under a specific user account. The account might be root and might not; there is always an account. The interface is to be defined, and the pkg installers augmented so each gets the runner it needs. So brew does not say "never elevate"; it asks for a runner under the invoking user's account, and apt asks for one under root. Mode is not needed, NeedsSudo() is replaced by "which account", and runCommand(argv, sudo bool) is replaced by a runner obtained by account. See § 5.
    5. Where does the fallback live? On the unit (6) or on the configured offer (draft). The configured place keeps the graph environment-agnostic; the unit place lets an author say "try the role, else ask me".
    6. Does ProcessSpawn own a worker, or ask the pool? Filled by rulings 1 and 4: an elevation guarantees access to an elevated process runner, and a runner is acquired by identity from the pool. The broker owns no worker; §6's {Start, Exec, WriteFile, Stop} leaves the draft. What remains of it is question 18.
    7. The config path: providers.authz under the profile tree, or a top-level authz section. configuration.md says the former.
    8. The config gate. Does the authz implementation wait for the recursive config tree, or does a first cut read the flat map[string]Section with the shape the draft gives? Step 38 ruled the design proceeds and the implementation waits.
    9. The grant's slot type. Narrowed by ruling 4: for the process case nothing crosses an edge. The pkg or service provider acquires its runner through the runner API, and the grant is the pool's business. The question stands only for identity assumption, where a token must reach appnet or a sandbox: whether it travels as a result, and what Zero() guarantees after the copy.
    10. Which substrates in the first cut? Narrowed by ruling 4: the command runner and the augmented pkg installers are substrate 1, and the ruling names them as the work. Identity assumption needs a broker and a consumer (appnet); the sandbox substrate needs sbx, which nothing in the tree has. Whether they are later features of one epic or epics of their own is still open.
    11. Windows. Does the first cut claim runas / UAC, or does Spike JEA: does headless Windows elevation exist at all? #528's JEA spike run first and Windows wait on its answer?
    12. The headless case. What happens when a System-scope deploy needs a grant and the strategy is interactive and there is no tty: refuse at preflight (the offer's strategy is known), pause, or fall back by the offer's chain.
    13. The default host-escalation offer. Its name, where it is configured, and whether writ's System scope asks for it by name or by Mode: Required on the system graph.
    14. The lease on a sudo grant. Filled by ruling 4: the lease is the runner's lifetime, and revoking it releases the runner, which the pool stops or retires per 6.2. There is no sudo timestamp to revoke, because the sidecar holds the privilege, not the caller's shell.
    15. elevator is removed: the stub is dead, and its rename plan is withdrawn #679 and the stub. Ruled 2026-10-21: the elevator is dead; delete it. elevator is removed: the stub is dead, and its rename plan is withdrawn #679's plan, "elevator becomes elevation, the stub stays", is withdrawn; elevator is removed: the stub is dead, and its rename plan is withdrawn #679 closes into the authz work or is retitled to the removal.
    16. The grant and the stack. Narrowed by ruling 4: for the process case the grant never travels as a result, so nothing of it is retained on the stack. For identity assumption the question stands as written.
    17. File operations under root. The ruling defines a command runner. writ's System graph does not run commands; it links, copies and makes directories under / through the file provider. §6's worker had WriteFile for exactly this. Three ways, for ruling: the sidecar also exposes file operations; the file provider's System-scope actions become commands through the runner (install, ln -s, mkdir), losing the provider's own semantics; or the whole System graph executes inside an elevated executor, which is what 2.4 § Planning describes, "1 system graph, sandboxed at the system root, elevated". This is the gap personal#289 actually lands on.
    18. writ's interim. Until authz exists, does personal#289 run the System graph under sudo writ deploy with the Home graph refused in that mode, or wait? Nothing in cmd/writ checks the effective uid today, so sudo writ deploy would deploy Home as root into root's home.

    5. The command runner (ruled 2026-10-21; interface to be defined)

    The ruling. An API acquires access to a command runner, a sidecar process that runs commands under one specific user account. Root is one account among others. Every runner has an account. The pkg installers are augmented to obtain the runner they need instead of deciding sudo by a boolean.

    What it replaces, in the tree. runCommand(argv []string, sudo bool) in pkg/platform/helpers_unix.go:58 and its twenty-odd call sites passing a literal true; runWindowsCommand(command, elevated); the uncalled NeedsSudo() on the manager interface; and 6.2's open item "how pkg/platform's manager backends reach the pool".

    How it fits what is settled. 6.2 already keys an execution host by identity, interpreter × privilege × pooling mode × session. The ruling generalizes the privilege axis to an account: an identity names the account the host runs as. Authorization is what grants access to a runner whose account is not the caller's; elevation is the case where that account is root (question 1). A runner under the caller's own account needs no grant.

    A sketch for ruling, not a design. In the vocabulary of pkg/process.Runner (Capture, Emit, Run, RunNarrating) and 6.2's identity:

    // An Account names who a runner runs as. The zero value is the calling process's own account.
    type Account struct {
        Name string // "root", "david-noble", "_www"; empty means the caller's own
    }
    
    // A RunnerIdentity is what a caller asks the pool for. It never names an instance.
    type RunnerIdentity struct {
        Interpreter string  // "sh", "pwsh", "argv"
        Account     Account
        Pooling     Pooling // 6.2's modes
        Session     string  // 6.2's session key, if any
    }
    
    // Runners hands out runners by identity. Acquiring one whose account is not the caller's
    // requires an authorization grant, which the pool obtains from authz.Provider.
    type Runners interface {
        Acquire(ctx context.Context, id RunnerIdentity) (Runner, Release, error)
    }
    
    // Runner is pkg/process.Runner's surface, bound to one account.
    type Runner interface {
        Capture(ctx context.Context, argv []string) (Result, error)
        Run(ctx context.Context, argv []string) error
        // Emit, RunNarrating as today
    }

    A manager backend then declares the account its commands need (apt root, brew the caller, launchctl a user agent under the caller and a system daemon under root), and the provider acquires that runner once per run and reuses it, which is the credential-paid-once property 6.2 wants.

    Open under this ruling.

    • Naming the account. By user name, by uid, or by role (root, caller, a service account)? Name is portable across Unix; Windows wants a SID or DOMAIN\user; a role keeps the graph environment-agnostic, which the three-way split requires.
    • Who declares it. The manager backend (apt knows it needs root), the action author, or the profile? Likely the backend for the pkg and service providers, and the author for shell.exec.
    • Non-root accounts that are not the caller. Running as _www or a service account is sudo -u, runas /user, or a launchd/systemd unit; which of these the sidecar uses is the broker's business, but whether the first cut supports any account other than root and caller is a scope question.
    • Remote runners. 6 § Remote execution puts runners behind ssh; the identity then carries a host too. In or out of the first cut?
    • The Windows sidecar. Start-Process -Verb RunAs is a UAC dialog, not a sidecar; Spike JEA: does headless Windows elevation exist at all? #528's JEA spike is what says whether a headless elevated runner exists on Windows at all.
    • Where the type lives. pkg/process (it is a runner), pkg/op (it is a pooled resource the executor manages), or the authz package (it is what a grant gives access to). The dependency direction decides: authz grants, the pool consumes grants, process does the running.

    6. Where the runner's design already lives (found 2026-10-21)

    No document owns the command runner. Its pieces are in four, and they disagree on three points.

    Document What it holds for the runner Where it is stale or conflicts
    6.2-process-pool.md (2026-08-17, no implementation) The spine. Hosts keyed by identity, interpreter × privilege × pooling mode × session; two kinds of persistence separated; lazy allocation; multiplexing by request id; per-run lifetime; §10 platform divergence (sudo the worker over a pipe; runas with a named pipe; JEA for headless Windows, unverified); §11: "the worker is a pooled host whose identity happens to be elevated" The privilege axis is binary, "unelevated or a resolved elevation identity". Ruling 4 makes it an account. Open question 2, "who acquires? the manager backends call a package var", is exactly the installers the ruling augments. Says nothing about file operations
    6-execution-topology.md § Approach, § Interface Shape, § Remote Execution The sidecar's shape. The worker is a generic command executor over a pipe; "file operations that need root (writing to /etc) go through the same channel"; {Start, Exec, WriteFile, Stop}; the remote Executor{Upload, Execute, Download} with the graph as the artifact that travels; SSH multiplexing Execute(cmd string, elevated bool) is a string, which 6.3 forbids, and a bool, which ruling 4 replaces. The op.Context / Do / Undo sketch predates the sealed model, by its own note. WriteFile is the one answer to question 18 the tree already holds
    6.3-command-execution.md (2026-08-19, no implementation) What is handed to a runner. An argv vector or a script file; tier 2's static body with values as $1; Result.Command; plan.shell.run and plan.shell.script Open: whether command= survives; env and cwd; stdin versus the y\n auto-confirm stream; the temp script's readability under the elevated identity; interpreter availability, which it hands to 6.2's identity
    1-system-model.md § 6 The execution model. Local flow landed; distributed flow a vision: one subgraph per machine, interface nodes, traces collected The remote runner is this vision's execution leg and nothing more specific
    2.4-hermeticity-guarantees.md The System scope is "sandboxed at the system root, elevated": one elevated executor per scope 6.2 § 12 says 2.4 must state that a reused host is a channel between units, and it does not yet
    pkg/process.Runner (code) The local, unelevated runner that exists: Capture, Emit, Run, RunNarrating Two of three spawn paths bypass it (6.2 § 1)

    The three disagreements the runner design must settle.

    1. File operations under root (question 18). Document 6 routes them through the worker's WriteFile; 2.4 runs the whole System graph in an elevated executor; 6.2 is silent. One answer, in one document.
    2. The identity's privilege axis. 6.2's binary privilege versus ruling 4's account. The account subsumes it, and 6.2 § 4 is rewritten to say so.
    3. The remote executor's signature. Document 6's Execute(cmd string, elevated bool) loses to 6.3's argv rule and ruling 4's account. The remote runner is a runner whose identity carries a host.

    What 6.2 already answers among the open questions. Question 12, the headless case, for Windows: § 10 rules that absent JEA "an elevated acquire there must fail as a named policy failure routed through the elevation failure contract, never block on a dialog nobody can see". Refuse, do not pause. The Unix headless case follows the same rule unless the owner wants a pause.

    What stays open from 6.2 and 6 together, now the runner's questions. The worker binary, the same binary behind --worker or a separate devlore-worker; the package-manager knobs (DEBIAN_FRONTEND, the y\n stdin) and where they live; retirement thresholds; pause and resume across a restart meaning a second credential prompt; the PowerShell serialization boundary; the JEA spike (#528).

    Recommendation for ruling. 6.2 becomes the runner's document: it already says the worker is a pooled host, and the ruling's account slots into its identity. It absorbs document 6's § Approach, § Interface Shape and § Remote Execution, restated onto activation records and receipts, and takes the file-operations answer. 6.3 stays as the form of what a runner is handed. Document 6 keeps the topology, SSH multiplexing and eventing, and the policy that 6.1-authorization fulfills. The alternative is a new 6.4 for the runner, leaving 6.2 as the pool beneath it; that is one more document for a split the ruling does not make.

    7. The daemon (ruled 2026-10-21, transports tentative)

    The ruling. The execution model is a daemon. Local clients reach it over named pipes ("I think"); remote clients over REST ("I think"). This is the new execution model, and it reaches the shell provider rewrite (#799).

    What it is, read against the tree. The daemon is the runner of § 5 made long-lived and shared: one per machine, owning the pooled hosts 6.2 describes, spawning runners under the account a client is authorized for. It is the sshd shape: a privileged service that authenticates a caller, authorizes a request, and runs the work as the requested account. Which makes it the place authorization is enforced: locally by the peer's credentials on the socket, remotely by a token, and elevation is the daemon spawning as root for a caller allowed to ask. The three substrates meet here: substrate 1 is the daemon's local API, substrate 2 is the token that opens its remote API, and a sandbox is a daemon reached from inside a microVM.

    The two "I think"s, with a precedent. Docker is this exact model: one HTTP API, served on a Unix domain socket or a Windows named pipe locally and on TCP with TLS remotely, and the client does not know which. Two notes on the words: on Unix a named pipe is a FIFO, one-directional and credential-less; the Unix equivalent of a Windows named pipe is a Unix domain socket, which carries the peer's uid (SO_PEERCRED / getpeereid), which the local authorization needs. And "REST" fits request and response but not a running command's stdout; the streaming leg is server-sent events or a WebSocket on the same server, or HTTP/2. Recommended for ruling: one HTTP API, two transports, socket or pipe locally and TLS remotely, streams by SSE.

    What it changes, by document.

    Document Today Under the daemon
    6.2 process pool a session service inside the executor, never a process singleton; hosts drain at the end of a run the pool lives inside the daemon, which is a singleton per machine; a client's run is a session the daemon tracks; hosts may outlive a run. § 4's session axis becomes the client session; § 12's hermeticity concern becomes the daemon's isolation between clients
    6 execution topology § Remote execution the graph and the runner binary travel over SSH; Execute(cmd, elevated) the graph or the command is posted to the remote daemon; SSH is at most a tunnel or a bootstrap; the executor abstraction is the client
    6 § Telemetry an event stream over SSH the same stream over the API's streaming leg
    6.3 command execution argv or script file handed to a host unchanged: it is the request body
    1 system model § 6.2 distributed vision a coordinator sends subgraphs to machines the coordinator posts subgraphs to daemons; the local case is the same call over the socket
    2.4 hermeticity the System scope runs in an elevated executor the daemon is that executor; the client never elevates. This is one answer to question 18: the daemon runs the System graph, file operations included
    6.1-authorization (the draft) authz.Provider acquires grants in the executor's process split: the client-side provider requests; the daemon holds the policy, decides, and spawns. Where ProviderConfig's offers and brokers live, client or daemon, is a question
    step 38 / #520 elevation policy as a graph and config concern the daemon's policy is the config concern; the graph still names what it needs

    What it changes, by issue.

    Questions the daemon opens.

    1. Command runner or graph executor? A daemon that runs commands serves the shell and pkg providers. A daemon that executes a posted graph serves 2.4's System scope and the distributed vision in one shape, and does the file operations itself. The second contains the first.
    2. One binary or two. devlore daemon or devlored.
    3. Protocol. HTTP over socket, pipe and TLS with SSE for streams (Docker), or gRPC over the same transports (buildkit, containerd). The REST "I think" leans to the first.
    4. Installation and the first elevation. The daemon runs as root, so installing it is the one elevation that cannot go through it: a launchd daemon, a systemd unit, a Windows service, installed by the service provider under sudo once. Who installs it, writ or lore, and whether a machine without it falls back to sudo -n or refuses.
    5. Local authorization policy. Who may ask for root: the peer uid's group membership, a daemon-side allow list, or the authz offers resolved in the daemon's own profile. Where the offers and brokers config lives, client or daemon or both.
    6. Remote authorization. Tokens minted by identity assumption, mTLS, or both. The first consumer of substrate 2 is then the daemon's own API.
    7. Per-user daemon versus system daemon. A per-user agent cannot spawn root; a system daemon can spawn anyone. Whether both exist, with the user agent for the caller's own account and interpreter state.
    8. Session and lifetime. Idle timeout; what a client's crash does to its runners; whether a run can be re-attached, which 6 § Long-running workloads wanted.
    9. Version skew. A client newer than its daemon, and the API's versioning.
    10. Where traces and receipts are written when the daemon executes: the daemon's store, collected by the client, as the distributed vision already says.

    8. The callback mechanism over the wire (design topic, 2026-10-21)

    The local model as ruled. Three pipes between the daemon and the runner it spawns: messages in on stdin, outputs on stdout, narration on stderr. That is the Bazel worker shape, and it stays as the daemon-to-runner hop.

    The wire is already chosen. 2.7-control-plane.md § The wire: HTTP/2, a REST plus server-sent-events facade that is curl-drivable, a gRPC twin on the same connection for typed clients, addressing by run id rather than connection, and a per-run monotonic seq on every event so a subscriber detects a dropped-oldest gap. Document 6 § Telemetry adds ndjson events, a log buffer, and "give me everything since X" on reconnect. The daemon's API is that listener, grown to carry a run's outputs and narration as well as its commands and events.

    Why the pipes do not carry over as pipes. A socket is one stream, so even the local client-to-daemon hop over a Unix domain socket or a named pipe has the remote problem: three channels on one connection. The answer is one framing for both hops: every outbound frame carries a channel tag and the run's seq; the daemon relays its child's three fds into tagged frames. Docker's attach stream and Kubernetes' exec channels are the precedents, one byte of channel per frame.

    The mapping.

    Pipe Direction Over the wire Precedent in the tree
    stdin, messages in POST /v1/runs/{id}/commands, one request per message, each its own HTTP/2 stream so the order is the client's; on the gRPC twin, the up direction of the one bidirectional stream 2.7 § The client surface
    stdout, outputs out frames tagged output on the run's event stream, seq-numbered; large or binary output by GET /v1/runs/{id}/output as application/octet-stream rather than base64 inside SSE 2.7 seq; 6 § Telemetry ndjson
    stderr, narration out frames tagged narration on the same stream, which is a change to 2.7: it makes narration "one per process, shared with the hosting application" and never a wire channel. With a daemon the hosting application is on the other end of the wire, so narration becomes a channel, rendered by the client's status.Narrator. It stays orthogonal to events: a distinct tag, not a projection of the event frames 2.7 § Framing, revised
    exit status, cancellation, heartbeat out frames tagged control; the exit status is a frame, never inferred from the stream closing 6 § Long-running workloads, heartbeats

    Ordering. Separate pipes never preserved order between stdout and stderr either, so the local model already accepts cross-channel reordering. One seq-numbered stream per run gives what pipes could not: a total order across outputs, narration and events, and a resume point. GET /v1/runs/{id}/events?since=<seq> replays from the daemon's per-run buffer, which answers 6 § Reconnection and 6's re-attach wish, and bounds the buffer by what 2.7 already says, drop-oldest with the gap visible.

    Live stdin. SSE is half-duplex, so a command that reads its stdin while running has no REST channel. Three choices: stdin content is an attribute of the request, a byte string or auto_confirm, which is what pkg/platform's y\n stream is today (6.3 open question 3) and covers every package manager; live stdin exists only on the gRPC or WebSocket full-duplex surface; or live stdin is not offered, and an interactive command is refused with a named failure like the headless elevation case. Recommended: the first by default, the second where a client library asks for it.

    What this settles if adopted. Document 6's "the graph and the runner binary travel over SSH" is replaced by this wire; its § Telemetry survives as the event frames; 2.7 gains the two outbound tags and the per-run output endpoint; 6.3's stdin question closes as a request attribute; and the daemon over the local socket speaks exactly the remote protocol, which is the property that lets ssh localhost be replaced by unix:///var/run/devlore.sock with zero client changes, the test document 6 asked for in other words.

    Open.

    1. Whether narration frames carry the already-rendered line or the categorized record (Note / Warn / Succeed / Fail plus text) for the client to render. The second keeps rendering on the client, where the terminal is.
    2. Binary output in SSE: base64 inline below a size, the octet-stream endpoint above it, or always the endpoint.
    3. Whether the gRPC twin is in the first cut or the REST facade alone, given Go clients are the only typed clients today.
    4. Backpressure on a chatty command: HTTP/2 flow control per stream handles the connection; the daemon's per-run buffer policy, drop-oldest or block the runner, is a ruling.

    8.1 The return path, as a sequence (2026-10-21)

    The runner never knows the caller. Frames are addressed to the run; the control plane relays; the originator is the first subscriber.

    1. writ, on its HTTP/2 connection to the control plane: POST /v1/exec {run: 7f3a, unit: u-12, account: root, argv | script, env, cwd, stdin} → 202 {exec_id: e-41}. Nothing else returns on that stream.
    2. Control plane: peer uid from the socket → authz for the account → the plug point, a RunnerSelector that returns a runner session for the account by the plugged policy (reuse by account, spawn on demand, capped pool, remote host).
    3. Control plane → runner, over its persistent multiplexed connection: exec {rid: e-41, argv, env, cwd, stdin}. It records e-41 → run 7f3a, unit u-12: the routing table for the return path.
    4. Runner: fork; read the child's stdout and stderr unconditionally into a per-rid spool (memory, then file), so a slow consumer never fills the pipe and blocks the child; drain the spool to the control plane as {rid, channel: output | narration | control, payload}.
    5. Control plane: look up e-41; stamp seq, ts, unit id; append to the run's buffer (memory ring over the run's file); publish to every subscriber of run 7f3a.
    6. writ: GET /v1/runs/7f3a/events held open; each frame an SSE event whose id: is seq, so a reconnect resends Last-Event-ID and the control plane resumes from the buffer, no since= parameter needed. writ demuxes: output to the unit's result, narration to the Narrator, control carries the exit status, which ends e-41 and not the stream.
    7. The stream ends with the run. One run, many execs, one stream.

    Properties: any subscriber sees the run; one seq per run gives total order across commands, which pipes never gave; every frame crosses the control plane and lands in the run's file, so the audit and the trace are the same record. The direct handoff (control plane hands the caller the runner's endpoint and a capability) saves a copy and loses all three, and needs an unprivileged client on a root-owned socket. Bulk output takes the octet-stream endpoint GET /v1/runs/7f3a/output?exec=e-41 from the run's file, with a capped inline chunk and a pointer on the stream. Unbrokered, the same frames arrive on writ's own connection to its user runner and writ stamps seq.

    Closes from § 8's open list: backpressure (the runner's spool, never the child's pipe; the control plane's ring drops oldest with the gap visible and the file keeps everything), and the resume mechanism (SSE id: = seq).

    8.2 Buffering narration apart from output (2026-10-21)

    Separated at the source, by fd. stdout is output, stderr is narration; the runner reads them with two independent pumps into two spools, so they never share a buffer and each is its own channel. Narration is lines of text: one frame per line, a maximum line length, a flush timer so a \r progress line still arrives, invalid UTF-8 replaced. Output is bytes: a frame per filled chunk or per timer tick, no decoding.

    Three buffers, three policies.

    1. Runner, per exec and per channel: the spool, so the child's pipe is always drained. Memory, then a file in the runner's scratch root; never dropped; a full disk fails the exec with a named error.
    2. Control plane, per run: an append-only events file (the record, both channels, one seq) and a memory ring over the recent frames for live subscribers and short reconnects. The ring drops oldest with the gap visible; a reconnect older than the ring is served from the file.
    3. writ, per channel: narration unbuffered, straight to the Narrator; output accumulated per exec up to a cap, beyond which the result holds a reference and the unit fetches from the octet-stream endpoint when it reads it.

    Structured narration from devlore children. stderr is narration only by convention; apt-get writes free text there, devlore run --graph has categorized records. Two ways: a source field on the narration frame (stderr raw, record structured) with the runner recognizing ndjson records on stderr, which is sniffing; or a third pipe, fd 3, opened when the exec says the child is devlore-aware, carrying records and hook events, with stderr staying the program's stderr. Recommended: fd 3. One field on the exec request, one more pump in the runner, and "stderr is stderr" stays true for every program.

    8.3 The fork at the control plane (ruled 2026-10-21)

    One request, three kinds of event, two destinations. A single POST /exec yields one response stream from the runner carrying every frame the exec produces, tagged output, narration, event or control. The control plane demultiplexes on the tag:

    • event → the event bus (2.8, with 2.7's subscription semantics). The logger is its subscriber: the run's events file and the OpenTelemetry exporter. GET /v1/runs/{id}/events serves other subscribers, a monitor; the caller is not one by default. The hook seam feeds the same bus from inside the control plane (unit scheduled, started, completed, status transitions), so telemetry is the union of what the runner reports about the exec and what the executor reports about the unit.
    • narration, output, control → the caller's stream, GET /v1/runs/{id}/console, the one stream writ holds open. Exit status rides it as control.

    Two sequences. Each sink has its own seq; they correlate by exec id, unit id and timestamp. Total order holds within the console stream (where a human needs it) and within the event stream (where a logger needs it); none is needed across them.

    In code: the relay is one goroutine per exec reading the runner's response body, a switch on the tag, two destinations. The runner does not know there are two; writ does not know there is a bus.

    Against 2.8's names: its three output streams are narrations, diagnostics and operational events. Telemetry is operational events. Diagnostics, a program's own stderr complaints, go to the caller as narration at a quiet level: the caller sees everything the command said, the logger everything the system did. This corrects § 8 and § 8.1, which had put event frames on the caller's stream.

    4. The epics, as the draft would have them

    Epic Today Change the draft implies
    #520 Elevation policy, Epic:ElevationPolicy two substrates; "the spec is not ready to build from"; features #521 (reconcile the spec) and #526 (give the plumbing a consumer); #679 unfiled Retitled and relabeled for authz; body says three substrates and names the new spec; #521 closes against the adopted spec with #522-#525; #526, #527, #528 stay; #679 becomes the authz rename or closes into it
    #815 Providers ruled 2026-09-05: every provider is a feature under it; lists elevator gains the authz provider as a feature; elevator leaves the list. This is where the provider's tasks file, by the ruling; the policy and graph side stay under #520. The two epics owning one subject is itself a question for the owner
    #442 Execution topology: how we shell, and how we elevate elevation as an axis of host identity; JEA gating names authz as the provider the pool serves; "how we elevate" becomes "how we authorize" if the word changes everywhere
    #451 Rename op to workflow serial window; vocabulary table gains the ordering decision from question 2, in its body or #520's
    #530 The execution graph no elevation content gains the grant-over-typed-slot question (G11) if the owner places it here rather than under #520
  3. David-Noble-at-work commented on Nov 9, 2026

    @David-Noble-at-work
    ContributorAuthor

    star github triage sweep added this issue to Triage: devlore, for the rule it breaks:

    • no-evidence: no Evidence of completion section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions