Repository navigation
AA10a: Save gate: proposal status, stored-proposal resolution, failure copy - #857
Merged
Merged
Conversation
…ution, failure copy Pure functions over the stored transcript and the turn's ProposalTurnState that decide whether a save may run and which card it writes - the structural "ask before you write" rule that holds even when the model ignores the prompt. transcriptProposalStatus/saveBlockingError gate the model save path (UNANSWERED same-turn cards, NO_PROPOSAL, ALREADY_SAVED); resolveStoredProposal refuses ambiguous, unknown, wrong-agent, stale, saved and discarded ids; identityOfProposal and openProposalCards serve the Apply route and the turn-context block. Every refusal is an AuthorToolFailure with model and plain-words copy; nothing writes to disk. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.
What changed
Pure save-gate logic for the Agent Author in
apps/agent-forge/server/author/proposal/— the structural rule that no proposal reaches disk until the user has seen and answered its card:gate.ts— pure functions only, no I/O:transcriptProposalStatus(messages, identity)scans the stored transcript for an identity's newest card: an okproposeAgent*part opens it, a matchingsaveAgent*part or the user's ApplyuiEventsaves it, a matchingdiscardPendingChangesclears it. Failed (ok: false) propose parts — including bounced reviews — never count as cards, and update tools are filtered peragentIdso a card for agent A never moves agent B's gate.saveBlockingError(turn, identity)decides whether a model save may run:UNANSWEREDwhen the card was proposed this turn (the stored transcript cannot know about it),NO_PROPOSALwhen discarded this turn or absent in the stored transcript,ALREADY_SAVEDwhen saved either way — one confirmation buys exactly one save.resolveStoredProposal(messages, identity, proposalId)resolves the stored card a save would write, refusingAMBIGUOUS_PROPOSAL(id on more than one tool call),UNKNOWN_PROPOSAL,WRONG_AGENT,STALE_PROPOSAL(carrieslatestProposalId),ALREADY_SAVEDandNO_PROPOSAL.identityOfProposal(which gate a bare proposalId belongs to, for the Apply route) andopenProposalCards(open cards for the turn-context block, newest last, named from each card'sspec.name).failures.ts— one builder per refusal code;error/nextare model-facing (name tools and ids),userMessageis plain words with no tool names or ids.wiring.ts— the runner'sturnContextInputnow lists real open proposal cards viaopenProposalCards(session.transcript)instead of[].The save tools, writes and HTTP Apply route are out of scope (AA10b); this PR lands the enforcement they call into.
How tested
gate.test.ts: all 24 rows of the scenario table (stored transcript × this-turn state), 24/24 pass.failures.test.ts: every builder returns non-emptyerror/userMessage/next; a scan rejects tool names and ids in user-facing copy.typecheck:serverclean;test:server1055 pass;npm test -- --run956 pass;typecheckandlintclean (warnings-only, pre-existing).tsc --noEmit,lint,test:coverage(480 files, 0 failures),fallow,docs:ratchet,api:check(20/20 up to date),docs:llms:check,size-checkall pass.Acceptance criteria
error,userMessageandnext; nouserMessagecontains a tool name or an id.Generated with Devin