Skip to content

fix: resolve race condition preventing concurrent permission gates fr… - #5550

Closed
utkarshtyagi-253 wants to merge 1 commit into
Agenta-AI:mainfrom
utkarshtyagi-253:main
Closed

fix: resolve race condition preventing concurrent permission gates fr…#5550
utkarshtyagi-253 wants to merge 1 commit into
Agenta-AI:mainfrom
utkarshtyagi-253:main

Conversation

@utkarshtyagi-253

Copy link
Copy Markdown

…om rendering

Summary

Testing

Verified locally

Added or updated tests

QA follow-up

Demo

Checklist

  • I have included a video or screen recording for UI changes, or marked Demo as N/A
  • Relevant tests pass locally
  • Relevant linting and formatting pass locally
  • I have signed the CLA, or I will sign it when the bot prompts me

Contributor Resources

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 29, 2026
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

@utkarshtyagi-253 is attempting to deploy a commit to the agenta projects Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added the bug Something isn't working label Jul 29, 2026
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @utkarshtyagi-253, thanks for opening a pull request. 🙏

This PR was automatically closed because it does not yet meet our contribution requirements:

  • The Summary section is missing or empty. Describe what changed and why using the PR template.
  • This PR changes functional code (SDK, API, or frontend) but includes no demo. Add a screenshot or short video of the change. Only test-only, docs-only, or chore changes may skip it.

We ask for this so every change is documented and demonstrably tested before review.

How to get it reopened
Update the PR description (and add a demo recording if your change touches functional code). The bot reopens the PR automatically once the requirements are met. No need to open a new one.

See the Contributing guide and Creating your first PR. If you think this was closed in error, leave a comment and a maintainer will take a look.

@github-actions github-actions Bot added the incomplete-pr PR is missing required template sections or a demo recording label Jul 29, 2026
@github-actions github-actions Bot closed this Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d9415bba-3f54-44c0-be5d-f6d43f4b707a

📥 Commits

Reviewing files that changed from the base of the PR and between a3e7fdf and 9a295a0.

📒 Files selected for processing (3)
  • services/runner/src/engines/sandbox_agent/acp-interactions.ts
  • services/runner/src/engines/sandbox_agent/pause.ts
  • services/runner/src/engines/sandbox_agent/run-turn.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved pause handling for tool calls awaiting permission decisions.
    • Prevented in-progress permission requests from being incorrectly marked as not executed when a turn is paused.
    • Preserved approved tool executions during pause and resume flows.

Walkthrough

Permission request lifecycle callbacks now identify tool calls entering permission handling. Pause tracking preserves in-flight permission calls during paused-turn settlement and removes them when calls become paused or allowed.

Changes

Permission pause flow

Layer / File(s) Summary
Permission lifecycle callbacks
services/runner/src/engines/sandbox_agent/acp-interactions.ts
Adds onPermissionRequestStarted to the responder input and invokes it for Pi and ACP permission requests using the extracted tool call ID.
In-flight permission pause handling
services/runner/src/engines/sandbox_agent/pause.ts, services/runner/src/engines/sandbox_agent/run-turn.ts
Tracks in-flight permission IDs, clears them when calls are paused or allowed, wires the callback into pause handling, and excludes in-flight calls from paused settlement.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PermissionGate
  participant attachPermissionResponder
  participant PendingApprovalPauseController
  participant runTurn
  PermissionGate->>attachPermissionResponder: send permission request with toolCallId
  attachPermissionResponder->>PendingApprovalPauseController: markPermissionRequestStarted(toolCallId)
  runTurn->>PendingApprovalPauseController: isInFlightPermission(toolCallId)
  PendingApprovalPauseController-->>runTurn: preserve in-flight call
  runTurn->>runTurn: settle other open calls as paused
Loading

Possibly related PRs

  • Agenta-AI/agenta#5041: Introduces the related ACP permission-responder and pause-controller flow extended by this change.
  • Agenta-AI/agenta#5158: Modifies the same ACP permission callbacks and sandbox pause handling.
  • Agenta-AI/agenta#5267: Changes paused-turn settlement for approval-related tool calls in the same flow.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working incomplete-pr PR is missing required template sections or a demo recording size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants