Repository navigation
AA09: proposeAgentUpdate: patch semantics, instructions edits, carried-over folding - #859
Merged
Merged
Conversation
…ions edits, carried-over folding 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
proposeAgentUpdate({ agentId, patch, instructionsEdits? })returns an update card whosespecis the saved spec plus any earlier unsaved card for the same agent plus this patch, with a server-computeddiffSpecsdiff against the saved spec.server/author/proposal/instructionsEdits.ts-applyInstructionsEdits: eacholdTextanchor must occur exactly once, edits may not overlap, applied right-to-left;ANCHOR_NOT_FOUND/ANCHOR_AMBIGUOUS(with count) /ANCHOR_OVERLAP(both indexes) results.server/author/proposal/fold.ts-pendingUpdateCard(this turn's proposal record first, then the stored transcript's open card via the save gate'stranscriptProposalStatus) andchangedTopLevelKeys(canonical-JSON compare inSPEC_FIELD_ORDER).server/author/tools/proposeAgentUpdateTool.ts- the tool: AGENT_NOT_FOUND, EMPTY_PATCH, EDITS_AND_INSTRUCTIONS, INSTRUCTIONS_IN_FILE and ANCHOR_* failures with the specified copy; anchors resolve against the folded base with one retry against the saved instructions; the pending card folds only while itsbaseSpecHashstill matches the saved spec (a canvas edit breaks the chain); then the AA08 pipeline (applyAuthorPatch, catalog checks, requirements,reviewDraft) produces the card, recorded underupdate:<agentId>inproposalTurnState. Registered inAUTHOR_TOOL_FACTORIES(15 tools now;readTools.test.tscount updated).Anchor failures carry
{ currentInstructions, retryWith: 'instructions' }wherecurrentInstructionsis exactly the text the edits were tried against. Nothing is written to disk.How it was tested
instructionsEdits.test.ts(7 tests) +proposeAgentUpdate.test.ts(18 tests incl. a real on-disk AgentRepo asserting nothing is written): all pass.npm run typecheck✅ ·npm run typecheck:server✅ ·npm test -- --run(968) ✅ ·npm run test:server(1090) ✅ ·npm run lint(workspace) ✅ 0 errors.npx tsc --noEmit✅ ·npm run lint✅ ·npm run test:coverage(7163 passed; needed--minWorkers=1 --maxWorkers=4and LF-converted CRLF template READMEs - Windows checkout artifact, zero content diff) ✅ ·npm run fallow✅ 0 above threshold ·npm run docs:ratchet✅ at baseline ·npm run api:check✅ all 20 reports ·npm run docs:llms:check✅ ·npm run size-check✅ under budget.distwas built - environment-only, unrelated.Acceptance criteria
{ tools: [] }on an agent with 2 tools → card with oneremovechange per tool andcarriedOver: false.{ description }(unsaved); turn 2 proposes{ tools }→ card spec has both,carriedFields: ['description'], changes list both.discardPendingChangesor a save, the next card does not fold (tested via stored discard part, save uiEvent, and turn-state marks).baseSpecHashmismatch).currentInstructions; a valid pair of edits applies both.Generated with Devin