Skip to content

secrets-broker: dual-host a standing broker on the sandbox (stage 2 of #10578) #10582

Closed

Description

@dezren39

Stage 2 of the 2026-11-15 broker-resilience order (follow-on to #10578)

Drew's order (main chat 2026-11-16T00:34Z): "Do it — retry fix first, then dual-host the broker", amended "retry in the binary".

Stage 1 is DONE: PR #10579 merged 2026-11-16T00:44:19Z (retry with ~2-min backoff in the fleet binary's secrets path; bws fallback given its own token; broker attempts time-bounded). #10578 closed with the diagnosis.

Stage 2 has not been done and has no live carrier (left-on-the-ground sweep, 2026-11-15 18:56 CST run: no PR, no queue task, no live session; stage-1 worktree wt-secrets-retry clean/idle; sandbox has no standing broker, though its Bitwarden machine token file already exists).

Work

Stand up a standing secrets broker on the sandbox:

  • secrets-broker role added to the sandbox's fleet config
  • loopback/UDS only — never a network listener
  • kept alive by the existing init-ensure pgrep pattern (sandbox has no systemd user bus)
  • warms from the Bitwarden token the sandbox already holds; read-only cache over the same Bitwarden source, broker semantics unchanged

Acceptance (proof)

  • Merged PR describing the change
  • Sandbox-local fleet secrets get for a known name proven served by the LOCAL broker (socket/process/log evidence, not just a successful return)
  • Same sandbox read still succeeds while the laptop broker/tunnel path is unavailable
  • A genuinely missing name still fails fast (404-class), not a 2-minute retry

Activity

  1. developing-today commented on Nov 16, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor
    {
      "task_id": 17404,
      "queue": "repo-health-code-pilot",
      "worker": "repo-worker-code",
      "lane": "any-b",
      "state": "claimed",
      "summary": "Picked up task 17404 (LEFT-ON-GROUND CHECKER for stage 2 of #10578) by lane any-b. Fresh revalidation 2026-11-16T01:16Z: issue #10582 OPEN, no labels at all (no hard-stop labels held/user/owned/do-not-merge/do-not-auto-edit, no status/needs-triage), only comment is the Kaneo link. Stage 1 PR #10579 verified MERGED. No PR references #10582 for stage 2; no sandbox secrets broker process or socket exists. Acceptance proof does NOT hold yet, so this lane does the stage-2 work itself (lane assignment: direct).",
      "next": "Implement sandbox dual-host secrets broker: UDS-only broker mode + spawn-managed secrets-broker role in fleet init + sandbox role in the built-in host map; provision sandbox fleet.toml/token, deploy one build to both installs, record local-serving proof on the PR."
    }
  3. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor
    {
      "task_id": 17404,
      "queue": "repo-health-code-pilot",
      "worker": "repo-worker-code",
      "lane": "any-b",
      "state": "claimed",
      "summary": "Picked up task 17404 (LEFT-ON-GROUND CHECKER for stage 2 of #10578) by lane any-b. Fresh revalidation 2026-11-16T01:16Z: issue #10582 OPEN, no labels at all (no hard-stop labels held/user/owned/do-not-merge/do-not-auto-edit, no status/needs-triage), only comment is the Kaneo link. Stage 1 PR #10579 verified MERGED. No PR references #10582 for stage 2; no sandbox secrets broker process or socket exists. Acceptance proof does NOT hold yet, so this lane does the stage-2 work itself (lane assignment: direct).",
      "next": "Implement sandbox dual-host secrets broker: UDS-only broker mode + spawn-managed secrets-broker role in fleet init + sandbox role in the built-in host map; provision sandbox fleet.toml/token, deploy one build to both installs, record local-serving proof on the PR."
    }
  4. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor
    {
      "task_id": 17404,
      "queue": "repo-health-code-pilot",
      "worker": "repo-worker-code",
      "lane": "any-b",
      "state": "claimed",
      "summary": "Picked up task 17404 (LEFT-ON-GROUND CHECKER for stage 2 of #10578) by lane any-b. Fresh revalidation 2026-11-16T01:16Z: issue #10582 OPEN, no labels at all (no hard-stop labels held/user/owned/do-not-merge/do-not-auto-edit, no status/needs-triage), only comment is the Kaneo link. Stage 1 PR #10579 verified MERGED. No PR references #10582 for stage 2; no sandbox secrets broker process or socket exists. Acceptance proof does NOT hold yet, so this lane does the stage-2 work itself (lane assignment: direct).",
      "next": "Implement sandbox dual-host secrets broker: UDS-only broker mode + spawn-managed secrets-broker role in fleet init + sandbox role in the built-in host map; provision sandbox fleet.toml/token, deploy one build to both installs, record local-serving proof on the PR."
    }
  5. added a commit that references this issue on Nov 16, 2026
  6. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    Stage-2 proof (from the merged commit, fully isolated env)

    Env: fresh temp HOME + XDG_RUNTIME_DIR + XDG_STATE_HOME, env -i (no BWS_ACCESS_TOKEN), fake bws first on PATH serving 2 secrets, no session-broker socket present.

    $ FLEET_LOCATION=sandbox fleet init
    fleet: location sandbox (source: $FLEET_LOCATION)
    fleet: proxy started; shims at $TH/state/fleet/shims [laptop-agent, repo-queue]
    fleet: secrets-broker started ($TH/run/fleet/secrets-broker.sock; loopback only)
    exit=0
    
    $ FLEET_LOCATION=sandbox fleet init   # again
    fleet: location sandbox (source: $FLEET_LOCATION)
    fleet: proxy already running (proto 1); shims current
    fleet: secrets-broker already running ($TH/run/fleet/secrets-broker.sock); nothing spawned
    exit=0
    
    $ curl --unix-socket $TH/run/fleet/secrets-broker.sock -H "X-Agent-Token: ..." http://localhost/secret/wanted.name
    {"key":"wanted.name","value":"local-proof-value","fetched_at_unix":1794792817,"age_seconds":11,"source":"cache"}
    
    $ time curl -o /dev/null -w 'HTTP %{http_code}\n' --unix-socket ... http://localhost/secret/no.such.name
    HTTP 404   (real 0m0.035s)
    
    $ SECRETS_BROKER_BIND=0.0.0.0:14812 FLEET_LOCATION=sandbox fleet serve secrets-broker
    secrets-broker: listening on 127.0.0.1:4800     # widened bind ignored; nothing on 14812
    

    Fake-bws call log confirms every backing fetch went local; cached reads add no fetch calls. Unit suites: 29/29 ok (fleet-config 45 incl. the updated builtin-map test, fleet-proxy 109, fleet-secrets 28).

    One incident during proving, repaired: an early non-isolated run let fleet init sync PATH shims into the live ~/.local/state/fleet/shims (targets rewritten to the test binary). Both symlinks re-pointed to /home/user/.local/bin/fleet, stamp exe field restored, targets verified; the final isolated run wrote shims only under $TH/state and live mtimes are unchanged since the repair.

  7. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor
    {
      "task_id": 17404,
      "queue": "repo-health-code-pilot",
      "worker": "repo-worker-code",
      "lane": "any-b",
      "state": "done",
      "summary": "Stage 2 is DONE and live. Canonical merged PR: https://github.com/developing-today/code/pull/10586 (merged 2026-11-16T01:37:31Z, commit 38667c8e02) — sandbox built-in role set gains secrets-broker, fleet init spawn-manages it, broker forced to loopback when FLEET_LOCATION=sandbox. Lane any-b built a parallel implementation (PR #10587) before #10586 appeared; #10587 is closed as superseded with the salvage note on #10586 (nothing unique required). Live proof verified by this lane 2026-11-16T01:47Z on the real sandbox, not only the isolated env recorded on #10586: broker pid 2741 (/home/hatch/tools/fleet serve secrets-broker, started 01:31:31Z by the init-ensure keep-alive after the 01:31Z sandbox recycle) listening 127.0.0.1:4800 + UDS ~/.config/secrets-broker/broker.sock, log 'refreshed 191 secrets'; direct UDS GET of a known name returned 200 source=cache (value not recorded) — a path that never touches the laptop broker/tunnel; UDS GET of a missing name returned HTTP 404 (broker read-through logged); sandbox fleet secrets get exited 0 in ~3 ms via the [secrets-broker] transport=socket pin in ~/.config/fleet/fleet.toml, which also carries the secrets-broker host role.",
      "next": "None. Checker task 17404 completes as superseded/fixed by PR #10586; issue closed."
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions