Repository navigation
opencode plugin - #3
Merged
Merged
Conversation
Owner
Author
Code reviewFound 1 issue:
plannotator/apps/opencode-plugin/index.ts Lines 119 to 122 in 1d927d1 Consider adding a timeout with Generated with Claude Code If this code review was useful, please react with 👍. Otherwise, react with 👎. |
backnotprop
added a commit
that referenced
this pull request
Jan 7, 2026
* opencode plugin * opencode plugin * marketing copy updates * opencode plugin marketing * readme for open code * readme enhancement;
backnotprop
added a commit
that referenced
this pull request
May 27, 2026
* Add session persistence foundation: suspend, reactivate, awaiting-resubmission Protocol: add "awaiting-resubmission" status (non-terminal), add "session-revision" event family, bump protocol version to 2. Session store: add suspend() (resolves waiters WITHOUT disposing resources — session stays alive), reactivate() (transitions back to active), and matchKey field on records. Server: skip the 2-second deletion timer on result endpoint for awaiting-resubmission sessions — they need to stay alive for the agent to resubmit. * Add cycle-based decision model and updateContent to plan server Replace one-shot resolveDecision with a cycle system — each deny resolves the current cycle and starts a new one. Approve resolves the final cycle. Agent-originated sessions return awaitingResubmission in the deny response. Add updateContent(newPlan) method that updates plan content, saves to version history, resets draft state, and publishes a session-revision event via the WebSocket hub. Add slug and getSnapshot to PlannotatorSession interface so the factory can match resubmissions and serve correct snapshots. Add session-revision to SessionEventFamily type. * Add session matching, persistent decision loop, and CLI support Session factory: add sessionRefs registry and findAwaitingSession() matching by matchKey. Plan sessions compute matchKey as plan:project:slug. On resubmission, existing awaiting session is matched and reactivated instead of creating a new one. Add registerPersistentDecision() — loops on waitForDecision(), suspending on deny and completing on approve. Replaces one-shot registerSessionDecision for plan sessions. Fix unhandled promise rejection: add .catch() to disposed promise in both registerSessionDecision and registerPersistentDecision. CLI: accept "awaiting-resubmission" as valid non-error status so denied sessions output feedback and exit 0 instead of failing. * Add awaiting-resubmission UI state to plan review Extend CompletionBanner with 'awaiting' variant — amber spinner with "Feedback sent — waiting for agent to revise..." message and optional cancel button. Plan review deny handler now checks response for awaitingResubmission flag. When true, shows the awaiting banner instead of the completion overlay. Subscribe to session-revision events via daemon WebSocket. When the agent resubmits and the session reactivates, the event carries the new plan content. The UI updates: markdown refreshes, previousPlan updates for diff, all annotations clear, awaiting state resets. * Document session persistence: AGENTS.md and backlog updates Add session persistence and resubmission section to AGENTS.md covering the awaiting-resubmission status, matchKey matching, and session-revision event family. Update backlog: mark #3 (live plan updates) and #4 (session persistence after completion) as done. * Self-review fixes: operator precedence bug and sessionRefs cleanup Fix operator precedence in registerPersistentDecision catch handler — was evaluating as (A && B) || C instead of A && (B || C). Extend findAwaitingSession to prune completed/expired/failed/cancelled entries from sessionRefs map, preventing slow memory growth over daemon lifetime. * Wire all three session types for persistence Extract createDecisionScope helper to eliminate duplication between registerSessionDecision and registerPersistentDecision. Define SessionDecisionResult type for explicit contracts. Annotate server: cycle-based decisions, updateContent for file-based modes, awaitingResubmission in /api/feedback response. Review server: cycle-based decisions, updateContent(rawPatch, gitRef), awaitingResubmission for non-approved feedback. Factory: generalize sessionRefs to PersistableSession interface. Add matchKey computation and matching for annotate (annotate:filepath) and review (review:project:branch or review:prUrl). Wire both with registerPersistentDecision. URL and annotate-last modes keep one-shot behavior (no persistent source to refresh). * Add awaiting-resubmission frontend state for annotate and code review Annotate: handleAnnotateFeedback now checks response for awaitingResubmission flag, same pattern as plan deny handler. Session-revision subscription already handles both plan and annotate since they share App.tsx. Code review: handleSendFeedback checks awaitingResubmission response. Add session-revision event subscription that refreshes diff data, clears annotations, and resets awaiting state. CompletionBanner shows awaiting variant for all three surfaces. * Quality fixes: extract updateContent, document findAwaitingSession Move plan server's inline updateContent closure to a named function handleUpdateContent for readability. Document findAwaitingSession's side effect of pruning terminal sessions during search. * Extract shared decision cycle helper, consistent updateContent naming Add createDecisionCycle<T>() and resolveAndCycle() to session-handler.ts. All three servers (plan, annotate, review) now use the shared helper instead of copy-pasting the cycle setup, resolve, and startNewCycle pattern. Deny handlers collapse to a single resolveAndCycle() call. Extract updateContent to named handleUpdateContent functions in all three servers for consistency — inline closures in return blocks replaced with named functions defined above the return. * Fix 5 review findings: snapshot provider, origin check, exit handling, empty content, TTL 1. Register no-op snapshot provider for session-revision in all three servers — prevents WebSocket disconnect when frontend subscribes. 2. Exclude plannotator-frontend from agent origins in resolveAndCycle — dashboard-created sessions complete on deny instead of hanging. 3. Complete session on exit: true in registerPersistentDecision — Exit button now properly terminates instead of suspending. 4. Check revision.plan !== undefined instead of truthiness — empty diffs and empty annotate content no longer ignored. 5. Store ttlMs on session record and restore it on reactivate() — reactivated sessions expire normally if abandoned. * Add session persistence design docs and decisions Captures the overview of what session persistence does, the technical architecture, and active design decisions from PR #770 triage — notably removing persistence from code review and redesigning the awaiting state. * Remove redundant HTML overview from tracking * Add version history and diff support to annotate sessions Reuses the plan review's version infrastructure for file-based annotate sessions. Revisions now save to history, the session-revision event carries previousPlan and versionInfo, and the frontend's diff badge, diff view, and version browser activate automatically. Also updates decisions.md with product facts and revised design decisions. * Long-lived code review sessions with idle status Replace the awaiting-resubmission persistence model for code review with a new "idle" session status. After sending feedback, the session stays alive and interactive — the user can annotate and send again. Agent reviews from the same directory attach to the idle session instead of creating a new one. The frontend shows a calm "Feedback sent" banner instead of a spinner. * Hide submit buttons while idle, no auto-dismiss After feedback is sent and the session is idle (no agent listening), the Send Feedback and Approve buttons disappear. They reappear when the agent reactivates the session via session-revision. Keyboard shortcuts are also blocked while idle. * Update decisions.md with implemented code review lifecycle Document the actual idle flow, resolve open questions, and mark Decision 1 and 3 as implemented. * Fix 4 review findings: idle TTL, late waiter, self-refresh, temp cleanup 1. Idle sessions with no ttlMs now get a fallback TTL instead of living forever (uses AWAITING_RESUBMISSION_TTL_MS as fallback) 2. waitForResult returns immediately for idle sessions with results instead of hanging forever on late agent checks 3. Review handleUpdateContent re-runs the diff with current user settings instead of accepting a pre-computed patch, and clears currentError. Preserves user's diff type and base branch choice. 4. Temp worktree cleanup on the review session reuse path * Fix PR mode review reuse: pass fetched patch instead of local diff For PR reviews, the diff comes from the GitHub/GitLab API, not from local git. handleUpdateContent now accepts an optional pre-computed patch for PR mode, falling back to self-refresh for local reviews. * Fix plan diff base tracking and linked-doc annotation leak 1. usePlanDiff now updates the diff base on every revision, not just the first. Previously the diff always compared against v1 after multiple deny/resubmit cycles. 2. Clear linked-doc annotation cache on session revision so stale annotations from linked files don't persist into the next plan version. * Exclude folder annotate from persistence, fix review loop survival 1. Folder-mode annotate sessions no longer participate in session matching or resubmission — they have no single document to track. Prevents empty content being pushed on resubmission. 2. Review decision loop uses promise identity tracking instead of idle() return value to detect cycle exhaustion. Survives double- submissions while still exiting cleanly for non-agent origins. * Scope annotate matchKey by project to prevent cross-project collisions The "document" filePath fallback created a global collision bucket for fileless annotate sessions. Now scoped as annotate:project:path. * Update decisions.md with cross-cutting facts and current open items Add cross-cutting requirements from review triage: external annotation flushing, waitForResult consistency, plan action disabling, snapshot provider, and architectural gaps (HTML pipeline, PR metadata). Replace outdated bug table with current open items reflecting what's fixed, what's deferred, and what's accepted. * Fix 5 cross-cutting issues: external annotations, waitForResult, plan actions, snapshots, docs 1. Clear external annotations on revision for all three servers (plan, annotate, review) — stale lint/agent comments no longer persist with wrong line numbers after content refresh. 2. waitForResult short-circuits for awaiting-resubmission sessions with results, matching the existing idle behavior. 3. Plan/annotate actions disabled during awaitingResubmission — keyboard shortcuts and header buttons gated. 4. session-revision snapshot providers return current content instead of null — late WebSocket subscribers get the latest state. 5. Comment on registerReviewDecision explaining intentional idle lifecycle (reviews stay alive, cleanup via TTL). * Collapse duplicate decision loops into shared registerDecisionLoop The persistent and review decision handlers shared ~80% of their structure. Extract a parameterized registerDecisionLoop that takes an onResult callback and activeStatuses set. Also drop an unnecessary cast and extract a named boolean in waitForResult for readability. * Fix 3 review findings: protocol test, legacy overlay, smart viewed-files retention 1. Update daemon-protocol test to expect session-revision event family 2. Wire feedbackSent to CompletionOverlay so legacy tab mode shows the full-screen close experience after sending review feedback 3. Add retainUnchangedViewedFiles() — on diff revision, only un-hide files whose patch actually changed; unchanged files stay hidden 4. Document viewed-files and legacy-mode facts in decisions.md * Fix CompletionOverlay feedback-sent visual to match CompletionBanner Both components now show success colors and checkmark icon for feedback-sent state. Previously the overlay used accent/chat-bubble while the banner used success/check — inconsistent for the same action. * Code quality: exit cycle, util location, docs, decision cycle comment 1. Review /api/exit uses direct resolve instead of resolveAndCycle — no dangling cycle left for the decision loop to block on 2. Move retainUnchangedViewedFiles from types.ts to utils/diffFiles.ts 3. Document createDecisionCycle promise identity invariant 4. Update AGENTS.md: correct annotate match key format, add idle status lifecycle for code review, add version history endpoints to annotate server table 5. Add session lifetime and timeout facts to decisions.md * Sessions never die: remove TTL, persistent all annotate types, fix 8 divergences 1. Remove AWAITING_RESUBMISSION_TTL_MS — suspend(), idle(), reactivate() no longer set expiresAt. Non-terminal sessions live until daemon restart. 2. registerPersistentDecision never calls store.complete() — approve and exit suspend the session like deny does. The agent still gets the result via resolveWaiters. 3. All annotate types (folder, last, URL) use registerPersistentDecision instead of one-shot registerSessionDecision. 4. Annotate /api/feedback returns feedbackSent instead of awaitingResubmission for non-revisable sessions (folder, last). 5. Plan review frontend handles feedbackSent state with feedback-sent banner. 6. Annotate handleUpdateContent accepts optional rawHtml for --render-html revision support. 7. Review /api/feedback ties feedbackDelivered to resolveAndCycle return value — dashboard sessions no longer get stuck. 8. Update decisions.md and AGENTS.md with sessions-never-die principle. * Self-review: pass rawHtml through annotate reuse path, fix interface and comment The factory's annotate reuse path called updateContent(input.markdown) without forwarding input.rawHtml. Updated to pass both. Also updated the AnnotateSession interface to match the new signature and fixed a stale comment about TTL expiry. * Clean up decisions.md: mark fixed items, update stale decisions, add backlog - Mark 5 open items as Fixed (external annotations, actions disabled, waitForResult, snapshot providers, render-html) - Update Decisions 4/5/6 to reflect current implementation - Fix Decision 1 cleanup line (sessions persist, no TTL) - Add gate flag resubmission gap to backlog - Add provenance data collection to backlog * Fix zombie listener, folder reuse, and button state on refresh - Approve/exit paths now use resolveAndCycle() so the decision loop stays alive for future resubmissions (fixes agent hang after approve) - Folder annotate sessions get a match key so re-running the same folder reuses the existing session instead of creating duplicates - All three servers track lastDecision and include it in the initial API response so frontends restore correct button state on refresh - Session-revision listeners accept snapshots and guard annotation clearing behind a content-change check to prevent data loss on WebSocket reconnect - Annotate updateContent is always provided (not just for file-based) so folder sessions can publish reactivation events * Fix snapshot state wipe, editor annotations, remote share, HTML draft key - Session-revision handlers only reset awaiting/feedback/submitted state when content actually changed, preventing WebSocket snapshots from wiping lastDecision-restored state on tab refresh - Add feedbackSent to annotate action bar disabled state so buttons hide after folder/annotate-last feedback - Add clearAll() to editor annotation handler; call it in plan and review handleUpdateContent so VS Code annotations don't survive across revisions - Regenerate remoteShare URL in all three session reuse paths (plan, annotate, review) so remote users get current share links - Fix raw-HTML annotate draft key to hash rawHtml instead of empty markdown, preventing cross-session draft collisions - Update overview.md: remove all stale 10-minute TTL references * Fix session-revision handler: distinguish snapshots from live events State resets (feedbackSent, awaitingResubmission, submitted) now fire on content change OR live events, but not on snapshots with unchanged content. This fixes two competing requirements: - Tab refresh: snapshot has same content, skip state reset (preserves lastDecision-restored state) - Folder reactivation: live event has same content, reset state (re-enables buttons after feedbackSent) * Fix dead import, HTML→markdown switching, standalone awaiting overlay - Remove unused PlannotatorSession type import from session-factory - Always assign rawHtml in annotate updateContent so clearing works when a file switches from --render-html to plain markdown - Wire awaitingResubmission into CompletionOverlay for standalone and legacy tab mode so deny shows a waiting screen instead of nothing
No description provided.