Skip to content

feat: emit permission spans so approval waits are visible in traces - #149

Open
enternal111 wants to merge 2 commits into
DEVtheOPS:mainfrom
enternal111:feat/permission-spans
Open

enternal111 wants to merge 2 commits into
DEVtheOPS:mainfrom
enternal111:feat/permission-spans

Conversation

@enternal111

Copy link
Copy Markdown

Which problem is this PR solving?

Tool approval prompts leave a silent hole in traces: between a step''s model response and its tool execution, the plugin emits nothing while the user decides, so a multi-minute approval wait is indistinguishable from model or client slowness (the decision is only emitted as a log event, which many backends drop).

Short description of the changes

  • permission.asked starts an opencode.permission span parented to the session''s active step span (the LLM step requesting the tool), falling back to the run span when no step is active.
  • permission.replied ends the span with the decision (permission.decision = accept/reject, permission.source = the reply), OK status on accept and ERROR on reject.
  • Execution-end sweeps end unanswered permission spans as cancelled.
  • New permission trace type, so OPENCODE_DISABLE_TRACES=permission (or all) turns the spans off.

How Has This Been Tested?

  • bun run typecheck
  • bun run lint
  • bun test (4 new permission-span tests: parenting, fallback, disabled, unanswered sweep)

Tool approval prompts currently leave a silent hole between a step''s
model response and its tool execution: the wait is only emitted as a
log event, which most backends drop. Record the wait as an
opencode.permission span parented to the active step (falling back to
the run span), ending when permission.replied arrives with the decision
recorded, or with an error when the execution ends unanswered. The new
permission trace type can be disabled via OPENCODE_DISABLE_TRACES.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T07:31:18.059801Z
We couldn’t complete this review. Comment @codex review to try again.
3bb7ea2 Manual request
ℹ️ 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 review" or "@codex security review".

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: 613e925be6

ℹ️ 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 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 address that feedback".

Comment thread src/handlers/session.ts Resolved
sweepExecution deletes the pendingPermissions entries first, and the
span sweep matches spans to sessions through that map, so an unanswered
permission span was never ended. Sweep the spans first and cover the
ordering through the public execution-end path.
@enternal111

Copy link
Copy Markdown
Author

@codex review

@enternal111

Copy link
Copy Markdown
Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 3bb7ea2fc5

ℹ️ 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 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 address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Setup repeatedly failed. Update the setup script or commit, then try again later.
ℹ️ 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 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 address that feedback".

3 similar comments
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Setup repeatedly failed. Update the setup script or commit, then try again later.
ℹ️ 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 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 address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Setup repeatedly failed. Update the setup script or commit, then try again later.
ℹ️ 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 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 address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Setup repeatedly failed. Update the setup script or commit, then try again later.
ℹ️ 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 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 address that feedback".

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.

1 participant