Repository navigation
feat(approvals): an approval covers what the person saw - #57
Closed
ahmad-ajmal wants to merge 22 commits into
Closed
ahmad-ajmal wants to merge 22 commits into
ahmad-ajmal wants to merge 22 commits into
Conversation
…ose by that order manifest.json may carry `transports`, an ordered list of cli, mcp and http. The first is the app's primary channel and the rest are fallbacks; without it the order is cli, mcp, http. Entries are kinds, never addresses. The gate checks it, the builder may edit it, toolkit-sync keeps it, `scaffold --transport` puts one first, and inspect reports it. Identity gains optional `transports` and `mcpUrl` (published by adapters in a later change). Arriving by CLI at an app that asks for another transport first says so. Skills, AGENTS.md and the README say how to choose, and how to operate over plain HTTP when there is no CLI. Spec: spec/v0_2/transports.md.
…ame its app adapter-core serves the app as an MCP server at POST /api/_a2app/mcp/<app id>. Each tool call is one request through the adapter's own router, so the guard, scopes, approval, idempotency, rate limits and audit are the ones HTTP callers meet. Ten tools, the same in every app (spec/v0_2/mcp-tools.json); MCP 2026-07-28 and, without sessions, the three handshake revisions before it. The caller is a credential, never a browser session. HTTP callers may name the app they mean (X-A2App-App); another app answers 409 app_mismatch. The CLI names a verified remote app on every call, and reads identity without its credential. Identity publishes `transports` and `mcpUrl`. Conformance class D covers the binding, and the starter conformance checks it against a running app on any stack.
Agents given only a task and an app picked the right transport each time, and stopped at every refusal. What slowed them is fixed: tools take an entity or operation by its own name, a declared operation is preferred over a raw write, the HTTP routes are listed in full, what to do when a scope or an approval is missing and the person can't be reached, and an MCP server that answers app_mismatch is another app's.
A destructive operation may name a read-only `preview` that says what it would do. Its answer comes with the 428, and the key covers it: when the answer changes, nothing runs, and the caller is shown the new one. Anything else that changes leaves the approval standing. Two fixes for every destructive operation: a key works only for the credential that asked, and a refused key always comes with one that works. A 428 says why (`reason`: asked, changed, spent, mismatch). The gate and the adapter refuse a preview that is not one. The sidecar runs an adopted app's own read route. The CLI shows the preview before the line that would run the call. The react-node starter's clear-done names list-done. Spec: spec/v0_2/approvals.md.
The read-only check used the name as written and the route decodes it, so a
percent-encoded name ("clear%2Ddone") passed the check and ran. The name is
decoded once, checked, and sent as that one segment. Scopes always applied; what
was missing is the promise a harness relies on when it runs a read-only tool
without asking. Found by the Go port's comparison run.
The bridge told every harness to use the a2app CLI. It now uses the first of the app's transports the run can reach, and writes the prompt for it. Over MCP, the harness gets a configuration file for that one run with the app's endpoint and the task's own credential: 0600, only its path in the arguments, removed when the run ends. Routes in harnesses.json gain `transports` and `mcpArgs`; the built-in claude route has the latter. An inbound route gets the app's address, order and MCP endpoint in its body. Plugins say what to do when the CLI is missing, and no longer call it the only way to operate an app. The account page shows the app's MCP address beside a new token.
This was referenced Nov 30, 2026
ahmad-ajmal
force-pushed
the
feat/approvals-native-adapters
branch
from
November 30, 2026 15:30
61f792c to
4d80fe9
Compare
- An agent that came by MCP is told the app's order: in the server's instructions, in whoami, and in the first describe (conventions.transports). The skill and AGENTS.md say to read it before the first call. - A 401 says where a credential comes from (A2APP_TOKEN, the account page), and no longer points at .agent-token. HTTP is reachable only with a credential in hand, where the work changes anything. - dev, the skills and AGENTS.md say that only a2app moves to the candidate: connected MCP tools and the usual address still reach the live app. - scaffold writes `transports` only when it is a choice, so an older agent-app accepts the app. It refuses --transport mcp on a blueprint that does not serve MCP, the gate refuses it on a running app, and serve names a malformed list. - starter conformance says what it did not check. - Docs keep the token off the command line; a missing CLI is the person's to install.
… that puts another first
…e described From the second audit. - whoami says when a credential gives less than the owner has, and such a caller is told to stay with it, not sent to a CLI that acts as the owner. - A2APP_TOKEN is one app's: A2APP_APP names it, and it goes to no other app. - a2app says nothing of the live app's transports while it answers from a dev candidate. - The SDK encodes ids, entities and operations in paths: `b-1?x` was `b-1`. - Bridge routes have arguments per transport, their own MCP configuration format and a JSON prompt; the run's values are in the environment. - Plugin tools follow the app's order, over MCP or HTTP without the CLI. - One table of transports, and what must name each is keyed by it.
Collaborator
Author
|
Replaced by #61, which has this same code. The branch is kept. |
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.
An approval covers what the person saw. Replaces #47 and #48: the same code, without the new test files. Their descriptions have the full details.
Merge after #56. Until then this diff includes it; see only this PR's changes.
What changes
preview. Its answer comes with the428, and the approval ends when that answer changes:reason: "changed", a new preview, a new key. Anything else that changes in the app leaves the approval standing.reasonon every428:asked,changed,spentormismatch.Spec:
spec/v0_2/approvals.md. New fields are optional.Things to know
preview.Tests
.testfiles are left out, on request. They stay on the old branch (feat/approval-preview).pnpm -r build,typecheckandtestpass on this branch, conformance 150/150. Before the files were left out, all of them passed against this same code.conformance/starter85/85 in each auth mode andconformance/multi-user77/77 on a running react-node app. Live, with a browser and an agent over MCP: after a change in the page the old approval was refused and nothing was removed.