fix(handlers): keep root session span open across session.idle#71
fix(handlers): keep root session span open across session.idle#71schemaitat wants to merge 1 commit into
Conversation
The opencode.session span and accumulated session totals were ended and deleted on the first session.idle event. Since a session keeps receiving turns after going idle, every subsequent turn's LLM/tool spans had no local session span to nest under and became orphaned root traces, with their token/cost contributions silently dropped from session.total_*. Keep the session span and totals alive across session.idle (only snapshotting attributes), and finalize them in a new handleSessionDeleted handler, on session.error, or on process shutdown.
|
Warning Review limit reached
More reviews will be available in 56 minutes and 11 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the PR. I took another pass on this after merging #74. My read is: What #74 did fix:
What #74 did not fix:
So I think #74 supersedes this PR for the tracing/orphan-span bug itself, but not for the separate question of whether From my side, that tracing fix is sufficient, and I would probably close this PR as superseded unless you specifically want to propose a follow-up focused only on session-wide accounting/log semantics across turns. |
Description
The
opencode.sessionspan and accumulated session totals were ended and deleted on the firstsession.idleevent. Since a session keeps receiving turns after going idle, every subsequent turn's LLM/tool spans had no local session span to nest under and became orphaned root traces, with their token/cost contributions silently dropped fromsession.total_*.Keeps the session span and totals alive across
session.idle(only snapshotting attributes), and finalizes them in a newhandleSessionDeletedhandler, onsession.error, or on process shutdown.Type of change
Checklist
bun run lintpasses with no errorsbun run check:jsdoc-coveragepasses with no errorsbun run typecheckpasses with no errorsbun testpasses with no errorsRelated issues
Supersedes #64 and #70 — same fix, rebased as a single commit on current
mainon a proper feature branch.Additional context
bun test— 282 pass, 0 fail.