Skip to content

Keep Claude lifecycle termination out of span errors - #203

Merged
Stephen Belanger (Qard) merged 4 commits into
mainfrom
fix/trace-error-outcomes
Oct 20, 2026
Merged

Stephen Belanger (Qard) merged 4 commits into
mainfrom
fix/trace-error-outcomes

Conversation

@Qard

@Qard Stephen Belanger (Qard) commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Treat idle pipeline retirement as a checkpoint rather than a terminal finalization, so resumed sessions do not receive premature end times.
  • Keep Claude's session root open across completed turns and subagent stops; only explicit session end or terminal invocation finalization closes it.
  • Start a new deterministic root span generation if Claude emits new activity after an explicit terminal end.
  • Close unfinished Claude spans at terminal finalization without assigning an execution error or extra lifecycle metadata.

Context

The debugging packet showed Claude task spans labeled Session ended before turn completion even when later turns ran in the same session. The daemon's idle reaper emits a Retire control to release resources, but the translation pipeline treated that as terminal finalization. Claude also ended its session root after each turn. These are resource/turn boundaries, not proof that the native session ended. Retirement now checkpoints buffered observations without closing native spans; later activity can continue the same deterministic root. An explicit SessionEnd closes that root, and a later reopened lifecycle gets a new root ID because the SDK update path cannot clear an already-written metrics.end.

The packet's empty-string tool errors and Codex exit-code misses are not reproduced in current source: Claude filters empty error text and Codex classifies nonzero exit_code output already.

Validation

cargo check --manifest-path bt-daemon/Cargo.toml, cargo fmt --manifest-path bt-daemon/Cargo.toml --check, and git diff --check passed. Tests were not run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T15:02:47.857612Z a95f888 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Qard
Stephen Belanger (Qard) force-pushed the fix/trace-error-outcomes branch 2 times, most recently from 94a0431 to b797fbb Compare October 20, 2026 15:39
@Qard
Stephen Belanger (Qard) merged commit ffd6b22 into main Oct 20, 2026
22 checks passed
@Qard
Stephen Belanger (Qard) deleted the fix/trace-error-outcomes branch October 20, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants