Skip to content

fix(claude): normalize recovered tool outcomes - #79

Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
normalize-tool-outcomes
Sep 14, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
normalize-tool-outcomes

Conversation

@AbhiPrasad

Copy link
Copy Markdown
Member

Transcript recovery marked every tool result approved and left matching
PreToolUse spans pending. Turn and session cleanup then attached lifecycle
errors, so denied calls looked approved and successful calls counted as
failures.

Reconcile transcript results with pending spans and derive approval, denial,
failure, and cancellation from native result signals. This keeps error and
approval analytics aligned with what actually happened.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 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-09-14T20:10:38.331388Z 159252e New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41e2adef95

ℹ️ About Codex in GitHub

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

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread bt-daemon/src/translate/claude.rs Outdated
Recovered tool output is arbitrary user-command data. Scanning successful output
for words like "denied" or "aborted" could relabel an executed tool as rejected
or cancelled, corrupting approval analytics in the opposite direction.

Only use free-form denial and cancellation phrases when Claude marks the result
as an error. Structured outcome fields remain authoritative on their own.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 159252e03f

ℹ️ About Codex in GitHub

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

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

@@ -851,11 +876,14 @@ impl ClaudeTranslator {
for id in ids {
if let Some(tool) = self.pending_tools.remove(&id) {
self.emitted_tools.insert(id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Drain transcript segments before cancelling pending tools

When a turn contains multiple assistant request IDs and a later tool's PostToolUse hook is missing, emit_main processes only the first transcript segment and leaves the rest for drain_pending; this loop then marks every still-pending tool as emitted and cancelled. Consequently, the later segment's terminal tool_result is skipped by emit_parsed, losing its output and real success, denial, or failure outcome. Defer cancellation until all queued transcript segments have been reconciled.

Useful? React with 👍 / 👎.

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