Skip to content

Bridge S7: PM stack direct bridge access at the edge (#14373, adopts #13502) - #14431

Merged
developing-today-fleet[bot] merged 3 commits into
mainfrom
felix/14373-pm-edge-bridge
Nov 24, 2026
Merged

developing-today-fleet[bot] merged 3 commits into
mainfrom
felix/14373-pm-edge-bridge

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Refs #14373, #13502 — the code half of S7 lands here; the live acceptance items (deploy + credential mint + laptop-away check) are listed at the end and stay open on #14373 until they are done, so this PR deliberately carries no Closes keyword.

What this does (design §4.8)

Bridge worker — a credential can be bound to a service identity: the owner mints directly (POST /api/<owner>/fleet/credentials/mint {agent, scopes?, addr?}), addr must be service:<its own name>, and sends under it go out from that address instead of agent:<name>. A third scope, read, opens the owner's two pipeline views (GET /fleet/<credential>/agents, GET /fleet/<credential>/messages) to the credential holding it. The enroll exchange still mints only inbox + send, so agents never receive read; the shared fleet token does not open the credential-side views either. Hash-only storage throughout, as in S3.

Console edge — message.send and the agents/messages reads go through the bridge Worker on the BRIDGE service binding, presenting the PM credential (BRIDGE_TOKEN, a Worker secret uploaded by scripts/expose.py --edge-direct from the vault name bridge.pm-stack-token). Sends are delivered at the edge as service:pm-stack and never held for a machine. Without the credential or the binding, behaviour is exactly the pre-change behaviour: the kinds/sections stay a machine's. A revoked or unknown credential answers a plain console-side error ("the bridge turned the PM credential away (unknown or revoked); nothing was sent"), never a silent hold — a bridge 404 is not a 401/403, so the edge's turned-away machinery does not hand the send to a machine.

Fleet hosted worker — the declared bridge capability is wired to the same binding and credential: POST /v1/bridge/send, GET /v1/bridge/agents, GET /v1/bridge/messages (src/bridge.ts + routes/bridge.ts), failing closed 503 when unconfigured, 502 naming the refusal when the credential is revoked. The capability document now reports the bridge domain available, filled by #14373.

Verification (remote only, fleet-command on this branch)

  • Run 45415227230 (head c07e03b): found 6 failures — bridge 82/83, console 598/602, hosted 208/209. All six were defects in this slice or its test updates; the follow-up commit 6d8da8b fixes each at its root (the S3 auth-shape expectation, the doors stub-table filter, the READ_FROM inventory, the missing read.agents wording, the self-check's refused-section retry, and an unearned checked date bump in workers.json — reverted, since this slice changed a description, not an outside re-check).
  • Run 45417551302 (head 6d8da8b, Target HEAD verified in the log; the run's conclusion reads cancelled only because it was cancelled during the known Post Execute hang after the Execute step completed):
    • bridge worker node --test test/*.test.mjs: 83 tests / 83 pass / 0 fail — the five new service-credential tests by name (mint, send provenance vs owner/agent rows, read-scope-only views, revocation, hash-only sql storage).
    • console bun test: 602 pass / 0 fail across 23 files — including the bridge-binding send/read tests and "without the credential, or without the binding, the bridge is still a machine's".
    • hosted worker npm test: 209 tests / 209 pass / 0 fail — including the bridge door tests (delivers as pm-stack, revoked credential named, unconfigured 503, capability resolves to the same binding).

Dependencies

None added. The only package.json change is the hosted-worker's test script gaining test/bridge.test.ts.

What remains for live acceptance (on #14373)

  1. Deploy the bridge worker with the mint route + read scope.
  2. Owner mints the PM credential ({agent: "pm-stack", addr: "service:pm-stack"}, default scopes send + read) and stores the value in the vault as bridge.pm-stack-token (value shown once, at mint).
  3. Deploy the console edge (Actions) and run expose.py --edge-direct so BRIDGE_TOKEN is uploaded; deploy the hosted worker with its BRIDGE binding + BRIDGE_PM_TOKEN secret if the hosted door is to be live.
  4. Live check with the laptop unreachable: send from the console UI, verify the row in the bridge store with from_addr service:pm-stack, confirm it never appears as waiting-for-a-machine; then revoke the credential and confirm console sends stop with the clear error while laptop-local dispatch is unaffected.

Left unmerged for Felix's review — he reads the credential-scope diff personally.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-24T14:54:18Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch",
      "repo": "developing-today/code",
      "branch": "main",
      "sha": "c11f41086f57d626be7eb582763b721f8f557408"
    },
    "auth_subject": "felix",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

felix added 2 commits November 24, 2026 14:29
)

Bridge worker: a credential can be bound to a service identity
(addr service:<name>) and minted by the owner with the read scope;
credential holders with read read the agents list and the message
log at the edge. Sends under a service credential go out from
service:pm-stack, apart from owner-sent and agent-sent rows.

Console edge: message.send and the agents/messages reads go through
the bridge on the BRIDGE service binding with the PM credential
(BRIDGE_TOKEN, uploaded by expose.py from the bridge.pm-stack-token
vault name); without it the old hold-for-a-machine behaviour is
unchanged. A revoked credential surfaces as a clear refusal, never
a silent hold.

Hosted worker: the bridge door (POST /v1/bridge/send, GET
/v1/bridge/agents, GET /v1/bridge/messages) over the same binding
and credential; the bridge capability reports available, filled by
this change.
Five defects the first remote verification run (45415227230) caught
in the slice's own suites:

- worker: the S3 sql-store test's expected credential-auth shape
  gains the addr field the service credential adds (null for an
  agent credential); the auth record itself is unchanged.
- hosted-worker: the bridge door joined DOOR_ROUTES live but was
  left in doors.test.ts's STUB_ROUTES filter, so the 501-stub guard
  hit it and got its unconfigured 503. It leaves the stub table,
  like every door before it when its filling issue landed.
- console: READ_FROM's inventory test learns agents: [bridge];
  REFUSED_SAID learns read.agents ("reading the agents list"), so
  a refused agents read is said in words like every other.
- console edge: the self-check again iterates every direct-read
  section, including ones currently a machine's for being refused
  (the check is how this side claims a section back; the pulls
  count in the turned-away test depends on it) — skipping only
  agents while no PM bridge credential is held, where there is no
  path here to prove.
- platform workers.json: the checked date goes back to 2026-11-23;
  this slice updated a description, it did not re-check every
  Worker's state from outside.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4520bfd9-29e6-44a2-95a3-97ada0810a97

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…ridge

# Conflicts:
#	pkgs/message-bridge/worker/src/fleet.js
#	pm-stack/console/src/reads.ts
@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Merge-refresh against current main (97808e5, which now carries S1 #14412, S2 #14409 and S3 #14407): merge commit 32d3cf9, pushed. This PR is mergeable again (MERGEABLE / CLEAN); left unmerged for Felix.

Conflicts and resolutions (2 files)

Everything else — fleet.js outside agentSend, messages.js, relay.js, routes.js, index.js, notes.js, the console edge files and the tests — auto-merged; verified no duplicate definitions and that each slice's pieces survive exactly once (S1 glob/distribution/broaden, S2 pipeline, S3 credential/enroll, S7 mint/read-scope).

  1. pkgs/message-bridge/worker/src/fleet.js — agentSend (3 hunks, one function). S1 added a broaden early branch (no-to form) plus limit/broaden on the relay call; S7 added the fromAddr parameter that fixes a credentialed send's sender address. Union: S7 signature kept; S1's broaden branch and relay limit/broaden kept; the relay from is fromAddr ?? agent:<name> (S7). One judgment call to flag: in S1's broaden branch, from_addr is fromAddr ?? agent:<name> rather than main's literal agent:<name>. For agent credentials and the shared token the two are identical (the route already forces d.agent to the credential's own name), and the relay broaden path S1 wrote already passes the full from. The literal would have made the two broaden paths disagree for a service credential and let one present as agent:<its name> in the no-to path — the union instead applies S7's already-reviewed invariant (a credential's from_addr is fixed to its own address) uniformly; the store still refuses any broaden whose from_addr is not the distribution's original sender. No mint/scope/auth/read-view code was touched.
  2. pm-stack/console/src/reads.ts — platformRead switch. Pure additive union: S7's messages case and main's trends case both kept.

Re-verification (remote only, fleet-command on developing-today/fleet)

Run 45422546793, log line verified: Target HEAD: 32d3cf96c98286fffa0e2f63aee0837be62911b2. Same three suites, same wrappers as the original verification (the run's conclusion reads cancelled only because it was cancelled during the known Post Execute hang after the Execute step completed with success):

  • bridge worker node --test test/*.test.mjs (via nix shell nixpkgs#nodejs_22): 98 tests / 98 pass / 0 fail (83 on the pre-merge branch + S1's net additions; includes S7's service-credential tests and S1's pattern/limit/broaden tests)
  • console bun test: 648 pass / 0 fail across 26 files (602/23 pre-merge; main brought the rest)
  • hosted worker npm test: 209 tests / 209 pass / 0 fail

All three suite exit codes 0. The live acceptance items listed in the PR body are unchanged and still open on #14373.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants