Repository navigation
Closed
Labels
Description
Part of #833. Implements change_patch and Change keys in The door, from the MCP surface. The context map puts change keys in Patchy MCP, so their table lives in packages/mcp.
What to build
change_patch { patch, tool, args, key }runs a change tool on Worker agents read patches through their agent tools #854's call path.keyis required. It is marked destructive and not idempotent. A read tool named here is refused, namingread_patch.- Keys are mapped, not passed through. A change key is any string the agent picks. Runtime's mutation keys have their own shape (
packages/runtime/src/MutationTransaction.ts), which stays as it is. So the first try of each change key gets a fresh mutation key from Patchy. - The record. A new table in
packages/mcp, with its migration allocated in landing order and composed intoapps/server/src/migrations.ts.- It keeps each change key for its connection and patch for 24 hours.
- It stores the first try's version, tool and arguments, and the mutation key it was given.
- So every host replica answers a retry the same way, and page keys are unchanged.
- Mutations.
- Retrying a committed change returns the original result with
replayed: trueand writes nothing. - An
unknown_outcomeresolves on retry. - A change whose result is too large reports success, with the result left out.
- Retrying a committed change returns the original result with
- Refusals.
- The same key with a different tool or arguments: "that key was used for a different change; pick a new one".
- A retry after a publish: "published since your first try; read before retrying", Runtime's rule that a key is bound to its version.
- A try whose first try is still running is refused
busy, withretryAfterSeconds: 1.
- Actions that write get no replay.
- A timed-out action's refusal says it may have partly happened: read first, then retry with a new key.
- Any later try with an action's key is refused without running.
- Events record
replayed, and never the key. - Skills.
patchy-server's "The agent area" gains, in the tested skill text's words, that a change key makes a mutation's retry write once, and that an action that writes is not safe to retry.
Done means
- Codex logs three calls in one
change_patchon a dev instance. - It retries with the same key, on another replica, and gets
replayed: truewith nothing written twice. key: "import-monday"works.- Each refusal above is answered as specified.
Surfaces
packages/mcp (migration, glossary Change key as written), apps/server/src/migrations.ts, the vitest template, the rollback rehearsal, packages/analytics, patchy-server, and docs/API.md for the shared shapes.
Activity
feat(mcp): the door at /mcp: revisions, request trust, the bearer and…
feat(mcp): worker agents read patches through their agent tools (#886)
feat(mcp): the log says which agent made each change: "Jordan Lee via…
feat(mcp): agents' calls are held to 300 a minute per patch and 16 in…