fix: track opencode session switches - #2455
Conversation
|
Warning Review limit reached
Next review available in: 47 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughOpenCode session reporting now distinguishes resumed sessions from new sessions. Terminal state accepts resume events and replaces the active lifecycle session. Tests cover report ordering, session sources, hook authority, state updates, and superseded-session rejection. ChangesOpenCode session resume
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant OpenCode
participant herdr_agent_state as herdr-agent-state.js
participant TerminalState
OpenCode->>herdr_agent_state: Select existing session through /session
herdr_agent_state->>TerminalState: Report session with resume source
TerminalState->>TerminalState: Replace active lifecycle session
OpenCode->>TerminalState: Send subsequent hook report
TerminalState-->>OpenCode: Accept current session state
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9dc12150-e42a-4e5c-b532-02d4ecce4fe4
📒 Files selected for processing (5)
docs/next/CHANGELOG.mdsrc/integration/assets/opencode/herdr-agent-state.jssrc/integration/assets/opencode/herdr-agent-state.test.tssrc/integration/mod.rssrc/terminal/state.rs
Greptile SummaryThe PR teaches the OpenCode integration to report explicit session resumes when
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/integration/assets/opencode/herdr-agent-state.js | Adds explicit resume reporting before lifecycle state when the root OpenCode session changes and updates the managed integration marker. |
| src/integration/assets/opencode/herdr-agent-state.test.ts | Adds regression coverage for selected-session reporting, overlapping switches, and pending new-session reports. |
| src/terminal/state.rs | Allows OpenCode resume reports to replace durable session identity and verifies lifecycle authority moves to the selected session. |
| src/integration/mod.rs | Keeps the embedded OpenCode asset version synchronized at version 10. |
| docs/next/CHANGELOG.md | Documents native restore tracking for conversations selected through OpenCode’s session command. |
Sequence Diagram
sequenceDiagram
participant U as User
participant O as OpenCode
participant P as Herdr plugin
participant T as TerminalState
U->>O: Select existing conversation with /session
O->>P: chat.message(selected session ID)
P->>P: Detect root-session ID change
P->>T: "report_agent_session(source=resume)"
T->>T: Reanchor durable session identity
T->>T: Clear previous lifecycle authority
P->>T: "report_agent(state=working)"
T->>T: Grant lifecycle authority to selected session
Note over T: Late reports from the previous session are rejected
Reviews (3): Last reviewed commit: "test: fail fast on missing opencode requ..." | Re-trigger Greptile
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c7ae0178-b40a-47ec-ba71-8dd4d1caf285
📒 Files selected for processing (2)
src/integration/assets/opencode/herdr-agent-state.jssrc/integration/assets/opencode/herdr-agent-state.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/integration/assets/opencode/herdr-agent-state.js
Summary
/sessionselects an existing conversationChecks
bun test src/integration/assets/opencode/herdr-agent-state.test.tscargo test opencode_ --bin herdrjust ciequivalent: 3,248 tests passed; the isolated-target-incompatible live-handoff PID test was excluded, and the unrelated graphics timeout passed on focused rerunjust windows-lintrefs #2450