Repository navigation
AA10b: saveAgent/saveAgentUpdate tools, shared writeProposal, Apply save route - #860
Merged
Merged
Conversation
…osal, Apply save route 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
server/author/proposal/save.ts(new):writeProposal— the single write path for model saves and the card's Apply button. It re-validates the stored card's spec with today'sagentSpecV2Schema(INVALID_STORED_PROPOSAL), writes exactly that spec insidewithAgentLock, captures asource: 'author'version withrequestText/authorSessionId, saves new agents disabled withcreatedFrom: { kind: 'author', ref: sessionId }, links created ids intosession.createdAgentIds, publishesagent.changed/versionon the workspace bus, and maps thrown errors toWRITE_FAILED. AlsorequestTextFor— the last non-empty, non-uiEventuser text before the card, cut to 400 chars.server/author/proposal/failures.ts: the four new refusal builders (INVALID_STORED_PROPOSAL,BASE_CHANGED,AGENT_GONE,WRITE_FAILED) with the contract's model/person copy.server/author/tools/saveTools.ts(new):saveAgent/saveAgentUpdatetools — AA10a blocking gate → stored-card resolution →writeProposaloverdeps.workspace()(an unresolvable workspace isAGENT_GONE); a success marks the identity saved inproposalTurnState. Registered inAUTHOR_TOOL_FACTORIES(17 tools now;AuthorToolDepsgainssessions).POST /assistant/sessions/:id/saveinserver/author/routes.ts: body{ proposalId }, 404/409-BUSY (running reply or save in flight),UNKNOWN_PROPOSAL/STALE_PROPOSAL/ALREADY_SAVED/BASE_CHANGED/AGENT_GONEas 400s (WRITE_FAILED→ 500,details.latestProposalIdcarried), then appends theuiEvent: { kind: 'save' }user message and answers{ ok, agentId, version, name, enabled, message }. The workspace resolves from the storedsession.workspaceIdviadeps.workspaceResolver, not the request header.RuntimeClient.saveProposal(sessionId, proposalId)returningAuthorSaveResponse;RuntimeApiErrornow keeps the server'scodeanddetails.How it was tested
npm run typecheck:server,npm run test:server— 85 files / 1121 tests green (incl. newsave.test.ts11,saveFlow.test.ts4,authorSave.test.ts14)npm run typecheck,npm test -- --run— 88 files / 968 tests greennpx tsc --noEmit,npm run lint,npm run test:coverage,npm run fallow(0 dead exports, maintainability 89.2),npm run docs:ratchet(at baseline),npm run api:check,npm run docs:llms:check,npm run size-check— all greenAcceptance criteria
saveAgent→ agent file exists,meta.enabled === false,createdFrom.kind === 'author', version 1 hassource: 'author'andrequestText= turn 1's user textUNANSWERED, nothing writtenALREADY_SAVEDSTALE_PROPOSALwithdetails.latestProposalIdBASE_CHANGED; nothing writtenspec(no re-sent copy, no model input)BUSYGenerated with Devin