Repository navigation
feat(approvals): an approval covers what the person saw - #48
Closed
ahmad-ajmal wants to merge 6 commits into
Closed
ahmad-ajmal wants to merge 6 commits into
ahmad-ajmal wants to merge 6 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.
This was referenced Nov 30, 2026
Collaborator
Author
|
Replaced by #57, with the 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 now covers what the person saw. A destructive operation may name a read-only
previewthat says what it would do. Its answer comes with the428, and the approval ends when that answer changes. This is step 1 of the proposal in #47, and replaces it. It is stacked on #45 and #46: review the last commit until those merge.Why
On a running app, an agent asked to run
clear-donewhen one task was done. The person marked a second one done and approved. The same key removed both.What changes
previewon an operation."clear-done"names"list-done". The adapter runs it with the call's own arguments, as the caller, when approval is asked for and again before the call runs. If the answer differs, nothing runs:428,reason: "changed", the new preview and a new key. Anything else that changes in the app leaves the approval standing.reasonon every428:asked,changed,spentormismatch.clear-donenameslist-done.changed.Spec:
spec/v0_2/approvals.md. The new fields are optional; the code, the header and the retry are unchanged.Things to know
previewuntil their own PRs. Theirdescribedoesn't publish it.Tests
adapters/adapter-core/test/approval.test.mjs: 53 checks, including expiry, restart, another caller, cut previews, a preview that fails and one that moves by itself.framework/cli/test/preview.test.mjs(gate and CLI), and 4 checks inreverse-proxy.conformance/starter/run.mjs: 85/85 against a running react-node app (both auth modes), andconformance/multi-user77/77. Its new checks are skipped, with a note, on adapters that don't have this yet.pnpm -r build,typecheckandtestpass on Windows, Node 24.