Work on Linear issue MM-370: Suggested branch name:…
- User
Work on Linear issue MM-370:
Suggested branch name: malpercio/mm-370-create_post-end-to-end-over-the-hosted-sidecar-on-staging
Acceptance:
- From an MCP client, authenticate against Custos (OAuth) and have a sovereign child agent create a post on staging via the sidecar.
- The post is attributed to the agent's own DID (not the parent's).
- The caller's token is forwarded per-request; nothing durable is cached.
- The existing self-hosted stdio path is unaffected (see MM-367).
Blocked by MM-368 (minting) and MM-369 (sidecar). Wave 8: auth.md An easy-to-host PDS on the ATProtocol, MacOS. Grandma-approved. c3080e4f-8a1e-47a8-99b8-022c854299d2
Design verdict: attribution and hosting are independent choices. Self-hosted "agent acts directly as me" (the shipped stdio MCP) stays first-class; for the hosted tier the agent becomes its own sovereign identity (own handle, recovery key held in the user's Obsign wallet) served by a tier that forwards the caller's credential rather than holding it. The only off-limits combination is hosted + acts-as-you + durable custody.
The two attribution models (both supported):
- Acts as you (delegate) — writes into your repo, actions carry your identity. Correct/safe for self-hosting (you hold your own credential); this is what
tools/mcp/ships today and must keep working. - Acts as itself (sovereign child) — own DID/repo/handle, recovery key in the wallet, day-to-day signing delegated + revocable. The hosted default — even a durable bot credential can't act as you.
Scope (from the design plan):
- Preserve + document the self-hosted acts-as-you path (stdio today; a self-hosted HTTP sidecar later). First-class, not a fallback.
- Sovereign child identity for the hosted path — own DID/repo/handle, recovery key in the wallet (reuses existing
did:plcgenesis/rotation machinery), delegated revocable signing. - Credential-forwarding hosted tier — MCP remote auth = OAuth against Custos (the existing AS); the caller's token rides each request; nothing durable is cached. Applies whether the tier is a Node sidecar or folded into axum.
- Sidecar first — reuse the
tools/mcp/tool surface, swap stdio → Streamable HTTP, singletonAgentSession→ per-caller map, deploy as a third Railway service () over private networking. In-PDS consolidation is a possible later step, not step one.
Assistant
I'll start by invoking the linear-workflow skill since we're picking up Linear issue MM-370.
Assistant
I'll fetch the issue from Linear and get set up. First, loading the Linear tool schemas.
Assistant
Both blocker PRs are confirmed in the base:
cfa2cedc(MM-368 minting) and18208f4d(MM-369 sidecar). Creating the branch from the fresh remote tip.Assistant
phase_03.md is the plan for this issue. Reading it in full.
Assistant
Now let me look at the hermetic PDS harness from
tools/mcpand the Phase-1 child-minting surface.Assistant
Now let me look at the remaining pieces: the mint route's tests (to see the exact ceremony), the revoke route, and the shared tool surface in
tools/mcp.Assistant
Now let me read the assertion→token exchange in the stdio package's auth module, and check the agent_auth config knobs (scopes) available via env.
Assistant
Let me see how the stdio conformance suite handles revocation, and what jwt_bearer does on revoked — that defines the legible caller-facing behavior I can compose.
Assistant
Not in devenv — I'll wrap build/test commands in
nix develop. Checking whether apdsbinary already exists.Assistant
All shapes verified. Now writing the code. First, checking the changelog fragment convention, then creating the files.
Assistant
Now the e2e runner (TLS wrapper) and the three test files.
Assistant
The
erasableSyntaxOnlyflag forbids constructor parameter properties — fixingTokenExchangeError(the module-resolution errors will clear once deps are installed).Assistant
Now the three test files.
Assistant
Nix daemon socket is blocked by the sandbox — rerunning with sandbox disabled (nix commands need the daemon).
Assistant
One typing fix needed in the exchange helper.
Assistant
Type-check clean,
pdsrebuilt. Running the e2e suite.Assistant
Now a Rust test pinning the new parent-arm behavior. Let me look at the existing test helpers in agents.rs.
Assistant
Appending a Rust test pinning the parent's audit access (and the preserved foreign-404):
Assistant
Now the justfile recipe and root AGENTS.md:
Assistant
The workflow edit was comment-only (no run-block changes). Now updating the
agents.rsrow in the PDS crate's AGENTS.md to record the parent-arm ownership:Assistant
Now Task 5 — verification. Running fmt + clippy on the Rust change, then both MCP suites and the stdio non-regression gate.
Assistant
Clippy clean (rustfmt reflowed one line). Now the full sidecar gate and the stdio non-regression suite.
Assistant
All 31 sidecar tests pass. Now the stdio non-regression gate (
just mcp-test) — this is the MM-367 acceptance criterion.Assistant
Stdio path green (5/5). Now the full pds test suite plus the shared static gates.
Assistant
6.1 GiB freed. Rerunning the pds test suite.
Assistant
All 1901 pds tests pass. Now the shared static gates.
Assistant
All gates green. Committing in three logical commits, then opening the PR.
Assistant
The push went to the tangled remote — GitHub is canonical for PRs. Checking the remote configuration.
Assistant
Dual-push remote — the branch should be on GitHub too. Creating the PR with
gh.Assistant
PR opened. Moving MM-370 to In Review with the PR attached, per the workflow.
Assistant
- User
The mcp service does exist in staging! It should be at https://obsign-mcp-staging.up.railway.app
Assistant
The sidecar being live means HV-2 — the Definition of Done — can be attempted right now against staging (it only needs MM-368/369 which are already on main; my PR's changes are test-side). Let me probe the deployed sidecar first.
Assistant
3.6 GiB free. Back to HV-2 prep — locating staging credentials and any existing interop accounts.
Assistant
There are commented-out staging credentials in
.env.local. Let me check the interop state for existing staging accounts, and extract the staging values without printing them.Assistant
Now applying the same validation to the other two origins in
loadConfig:Assistant
mcp.obsign.orgwithout a port already fails URL parsing (good — still loud). The scheme-check case needs a port-carrying value. Adjusting the test:Assistant
All 27 pass. Adding a one-line note to the deploy docs, then committing and pushing to the PR.
Assistant
The live HV-2 attempt got 90% of the way and found a real deployment misconfig plus a code gap, both now handled. Here's where things stand:
What already works live on staging — the run proved most of the chain against the real deployments:
- Ephemeral parent provisioned through the full ceremony on
ezpds-staging()
- Ephemeral parent provisioned through the full ceremony on
- User
I've flipped the var
Assistant
Rerunning the HV-2 driver against staging.
Assistant
Closer — the host now resolves, but the scheme is
https://and the PDS speaks plain HTTP on the private network (Railway's edge only terminates TLS on public domains, and thepdsbinary itself serves plain HTTP). Thewrong version numberSSL error is the classic https-to-an-http-port signature.One more tweak needed:
MCP_SIDECAR_PDS_ORIGINshould behttp://ezpds.railway.internal:8080—http, nothttps. Once that's flipped I'll rerun.- User
d'oh, sorry. fixd
Assistant
Strays cleaned (children revoked, parents queued for the reaper). Recording the live pass on the PR and Linear.
Assistant
HV-2 is done — the acceptance-defining slice works live on staging, end to end. The full report:
- The post:
at://did:plc:5xbotomihodrqalq54rd7rj2/app.bsky.feed.post/3mqrbokkw442p— created bycreate_postover the deployed sidecar's Streamable-HTTP transport, with the child's jwt-bearer token forwarded per-request.
- The post:
- User
should we tuck away the hv2 scripts in a commit so that we can easily get them later? is anything sensitive in them?
Assistant
Good idea — and I checked: nothing sensitive is in them. Both scripts read credentials exclusively from env (
EZPDS_ADMIN_TOKEN,EZPDS_BASE_URL) and never print a token; the only literals are public URLs. The staging admin token itself stayed in.env.localthe whole time.I'll tuck them into the PR as a proper
test/live/pair with usage docs. Moving and polishing the headers:Assistant
Done. The scripts now live in the PR as test/live/hv2-create-post.mjs and test/live/hv2-cleanup.mjs (commit
2a85cda0), with a README section explaining what they compose and how to run them.On sensitivity — I re-audited before committing:
- No secrets in the files. Both read
EZPDS_BASE_URL/EZPDS_ADMIN_TOKEN/MCP_SIDECAR_URLfrom env and never echo a token; the admin token only ever rides anAuthorizationheader. The only literals are public URLs, and I generalized the header docs so the usage block shows placeholder env exports rather than anything real. - The report output is clean too — it prints DIDs, handles, record URIs, and the public plc.directory document, all of which are public network facts by design.
- No secrets in the files. Both read
- User
coderabbit requested changes
Assistant
Now replying on the thread and resolving it:
Assistant
CodeRabbit's review is handled — it had one actionable finding, now fixed, replied to, and resolved (pushed as
60028339).What it flagged (legitimate quick win): the e2e teardown wasn't exception-safe — if
sidecar.close()rejected,pds.stop()was skipped, leaking the child process (which would wedgenode --teston the open handle); and an openssl failure inrun-e2e.tsexited before deleting the throwaway TLS dir. Both fixed: the fixture now has a shared best-effortteardown()helper that attempts every step regardless of earlier failures, and the runner removestlsDirin afinallyon every exit path.What I declined: the embedded ast-grep "path traversal" warning on the
pds.tomlwrite — noise, since the path is the fixture's ownmkdtempdirectory with no external input (noted in the thread reply).The e2e suite re-ran green (5/5) with the changes, and the type-check is clean. PR #292 is ready for another look — heads up that CodeRabbit tends to post a fresh micro-review on each push, so there may be one more small round.
- User
merged
Assistant
MM-370 auto-transitioned to Done on merge, and local
mainis fast-forwarded to the squash commit44d5a2ff. Tidying up the branch and memory:Assistant
That closes out MM-370 end to end. Final state:
- Linear: MM-370 is Done (auto-transitioned on merge), with the HV-2 evidence comment attached. Every Phase-0/1 child of MM-356 is now complete — and the merge unblocks MM-374 (fold the MCP endpoint into axum) whenever you want it.
- Git: local
mainfast-forwarded to44d5a2ff, merged branch deleted. - CI/deploys: the main-push CI run is in progress; once green, Railway's "Wait for CI" deploys staging with the
/v1/agentsparent-ownership fix, and the sidecar service rebuilds too (its watch paths covertools/mcp-sidecar/**) — it'll restart clean under the new origin validation since the env var is now correct.
Two small optional follow-ups, whenever you feel like them:
- Once staging redeploys, I can spot-check the one assertion that couldn't run live pre-merge — the parent reading the child's audit trail via
GET /v1/agents/{id}/audit(the demo parent's credentials are still in this session's state dir). - The demo parent + child from the successful HV-2 run are still live on staging (including the post) — say the word and I'll run to retire them.
- User
staging has redeployed
Assistant
Running the post-deploy spot-check — the parent reading the child's audit trail via the newly deployed
/v1/agentsownership fix:Assistant
The last live gap is closed. One more probe to confirm the redeployed sidecar came up clean under the new startup validation:
Assistant
Everything checks out — the full acceptance picture is now verified live with nothing outstanding:
- Parent audit access works on staging:
GET /v1/agents/reg_973e…/auditas the parent returns 200 with exactly the two events from the HV-2 run —token_exchanged(the jwt-bearer exchange) andrepo_write(thecreate_post), both attributed to the child DIDdid:plc:5xbotomihodrqalq54rd7rj2. Before the merge that trail was readable by no one; now the accountability loop is closed. - The redeployed sidecar is healthy under the new startup origin validation, still advertising the correct public Custos AS.
That's every MM-370 acceptance criterion demonstrated live: sovereign child posting via the sidecar, child-DID attribution, per-request forwarding with nothing durable, stdio path untouched, and the audit trail naming the agent.
The only remaining artifact is the HV-2 demo pair on staging (parent
hv2-parent-bvvv…, childhv2-agent-bmw1sb…, and the post). It's harmless to leave — the child is inert and the post is a nice live demo of the model — but whenever you want it gone, onehv2-cleanup.mjsrun retires it.- Parent audit access works on staging:
- User
go ahead and retire it
Assistant
Retired:
- Child
did:plc:5xbotomihodrqalq54rd7rj2— delegated capability revoked (200); no further token exchange can act as it. - Parent
hv2-parent-bvvv— deactivated with adeleteAfter; the server reaper permanently purges it (repo, sessions, handle) after 14:06 UTC.
One honest caveat: revocation kills the child's capability, not its account — that's the ADR-0023 design (revocation never surrenders the identity). So the child's repo and its HV-2 post technically still exist on staging as an inert, unactionable account, and the plc.directory entry is permanent by nature. If you ever want the post itself gone, that would take an operator-side takedown/delete of the child account — there's no self-serve path since the child's only credential is the now-revoked capability (arguably a small future consideration for parent-driven child deletion, if orphaned child repos ever bother you).
That fully wraps MM-370 — merged, Done in Linear, HV-2 verified live, audit access confirmed post-deploy, and the staging test artifacts cleaned up.
- Child
- User
hm, I do feel like parents should have the capability to delete children. Should we make a linear issue for this?
Assistant
Yes — it's a real lifecycle gap (revocation deliberately never surrenders the identity, but that leaves permanently orphaned child repos with no deletion path at all). Creating the issue with the design context captured while it's fresh:
Assistant
Filed as MM-400: Parent-driven permanent deletion of a sovereign child agent — Backlog, project
ezpds, labeled Wave 8: auth.md, related to MM-368 and MM-370, with today's orphaned demo child as the motivating example.The issue captures the design tensions worth deciding up front:
- Delete purges hosting, not identity — the PLC tombstone stays wallet-driven (the wallet holds
rotationKeys[0]and already has a permanent-removal flow), so server-side delete is "purge the account/repo + emit#account status=deleted", cleanly layered under ADR-0023's custody ladder. - Grace vs instant — I leaned toward the existing deactivate +
deleteAfter+ reaper pattern for an undo window and machinery reuse. - Audit survivability — purging the child could take its
agent_identitiesrow (and thus its audit trail) with it; the issue flags keeping the registration row as a tombstone, V030-style, so the parent's accountability view outlives the account.
- Delete purges hosting, not identity — the PLC tombstone stays wallet-driven (the wallet holds