Repository navigation
D08b: Suggestion routes: list, apply (hash-guarded), dismiss - #870
Merged
Merged
Conversation
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…utes # Conflicts: # apps/agent-forge/server/__tests__/workspaceSeam.test.ts # apps/agent-forge/server/app.ts # apps/agent-forge/server/workspace/__tests__/middleware.test.ts # apps/agent-forge/server/workspace/context.ts
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/routes/suggestionRoutes.ts(new):GET /agents/:id/suggestions(prompt_edit records only, open first thencreatedAtdesc; 404LOUSHO_AGENT_NOT_FOUND),POST .../:sid/applyandPOST .../:sid/dismiss.:sidis checked againstSUGGESTION_ID_RE(400LOUSHO_SUGGESTION_ID_INVALID); a missing record or a portability analysis is 404LOUSHO_SUGGESTION_NOT_FOUND; a settled one is 409LOUSHO_SUGGESTION_NOT_OPEN.withAgentLock(id): reconcile external edit → read spec →instructionsnot a string → 409LOUSHO_SUGGESTION_UNSUPPORTED→ prompt hash mismatch oroldTextoccurring other than once (indexOfloop, no regex) → record markedconflict+ 409LOUSHO_SUGGESTION_CONFLICT→ literalreplace(old, () => newText)→ schema check (400LOUSHO_SPEC_INVALID) →writeSpec→versions.capture({ kind: 'update', source: 'suggestion' })→ 201VersionListItem, recordapplied,agent.changedreasonversion.server/app.ts: registers the routes (per the workspace seam, handlers readworkspaceOf(req).repo/.versions/.suggestions— no deps or singleton store) + route-list doc comment.src/runtime/runtimeClient.ts:listSuggestions(id),applySuggestion(id, sid): Promise<VersionListItem>,dismissSuggestion(id, sid): Promise<void>.How tested
server/__tests__/suggestionRoutes.test.ts(10 tests, seeds vianew SuggestionStore(repo).save(...)) and aRuntimeClient suggestion methodsblock insrc/runtime/__tests__/runtimeClient.test.ts(4 tests).npm run typecheck+npm run typecheck:server(apps/agent-forge): pass. Studio suites: 972 client + 1141 server tests pass.npx tsc --noEmit,npm run lint: clean. Studio eslint: 0 errors (31 pre-existing warnings).npm run test:coverage: 7190 pass; the only failures are 6 known environmental CRLF template-README assertions (unrelated to this diff); coverage 96.94/90.67/96.35/96.94, above thresholds.npm run fallow(0 above threshold),docs:ratchet(at baseline),api:check,docs:llms:check,size-check: all pass.Acceptance criteria
source: 'suggestion', statusapplied.PUTchanging the instructions, apply → 409 conflict and statusconflict.oldTextpresent twice → 409 conflict.oldTextcontaining$&or.*is replaced literally (the replacer function form).LOUSHO_SUGGESTION_NOT_OPEN.Generated with Devin