Stabilize OpenCode pending approval/question compatibility
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- backend-api-design, testing-qa
Research direction
Start with src/server/routes/agent.test.ts, src/server/routes/approval.test.ts, and src/server/sse/broadcaster.test.ts, then inspect the adapter interfaces and route mocks around listPendingPermissions. Run the listed Vitest and TypeScript checks, and verify that both tree routes, approval/question replies, pending-state precedence, and SSE cleanup meet the acceptance criteria.
Written by the indexing model from the issue text.
Description
Goal
Make pending permission/question discovery and reply handling reliable across /api/tree, /api/agent/tree, approval routes, SSE state, and OpenCode 1.3.
Derived from #14 Phase 6 dirty branch handoff.
Scope
- Decide the canonical pending-state source: direct OpenCode REST, SSE broadcaster memory, or a documented merge of both.
- Validate
/permission,/question, and/question/:requestID/replyrequest/response shapes against OpenCode 1.3. - Update adapter interfaces and route tests together.
- Preserve read-only session state except explicit approval/question replies.
Out of Scope
- Do not change final UI interaction design in this issue.
- Do not push the broad dirty worktree into PR #13.
- Do not mutate GitHub/Gira state from Agentree runtime.
Acceptance Criteria
Functional:
-
GET /api/treeandGET /api/agent/treeexpose pending permissions/questions consistently. - Pending status overrides are deterministic when permission and question are both present.
- Question replies use the OpenCode-compatible payload shape.
- Freeform and option answers have regression tests.
- SSE cleanup after reply/reject is covered by tests or explicitly documented as eventual-consistency behavior.
Code/product quality:
- Adapter boundaries are clear and route mocks match the updated interface.
- Error handling is explicit for missing OpenCode endpoints or malformed pending payloads.
- The route behavior remains read-only except explicit approval/question replies.
Verification
./node_modules/.bin/vitest run src/server/routes/agent.test.ts src/server/routes/approval.test.ts src/server/sse/broadcaster.test.ts./node_modules/.bin/tsc -p tsconfig.json --noEmitgit diff --check- Optional/manual: run against a live OpenCode 1.3 server with one permission request and one question request.
Notes
Current dirty-branch evidence from #14: route tests fail because agent.ts now calls opencodeAdapter.listPendingPermissions, but the existing test mock does not provide that method. approval.test.ts and broadcaster.test.ts passed in the handoff run.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from StatPan/agentree
-
agent:worker area:docs priority:p2 status:ready type:chore
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
-
agent:worker area:backend priority:p2 status:ready type:task
Difficulty 3/5 1-2 days Newbie friendliness 76/100
-
agent:worker priority:p2 status:ready type:chore
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
agent:human priority:p1 status:blocked type:story
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
All issues in StatPan/agentree
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·