Skip to content

[fix] Keep queued input behind starting approval continuations - #6600

Merged
mmabrouk merged 1 commit into
release/v0.115.2from
fix/release-1152-resume-queue
Sep 6, 2026
Merged

[fix] Keep queued input behind starting approval continuations#6600
mmabrouk merged 1 commit into
release/v0.115.2from
fix/release-1152-resume-queue

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Sep 6, 2026

Copy link
Copy Markdown
Member

Sending Queue immediately after approving a tool could start a fresh run and cancel the approved work. During continuation startup, Redis can report running while the durable stream header still names the settled parent; the admission recheck previously looked only for successors promoted from queued inputs.

The same locked recheck now also finds and locks an unsettled continuation before allowing fresh execution. Queue remains pending behind the approved run, and Steer targets that continuation. Terminal continuations still allow a fresh run. This adds no schema or configuration changes.

Validation: six new real-Postgres cases reproduced the failure before the fix. All 19 affected database tests and 16 admission service tests pass, including terminal fallback, settlement arbitration, promotion, and idempotency. Ruff formatting/checks pass. Two independent release-agent reviews found no blockers. A targeted live local approval-resume run passed11 assertions: Queue returned202 targeting the approved child, its tool completed, and the queued followup drained without cancellation or error. The startup window was held by temporarily restoring only the disposable session’s old durable header; it was restored immediately after admission. The same paid run supplied final evidence, with no paid rerun.

@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 6, 2026 2:11am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: d76a7702-a0e3-4b4c-92e4-a0d44372bc9a

📥 Commits

Reviewing files that changed from the base of the PR and between 094ee60 and 19b0077.

📒 Files selected for processing (4)
  • api/oss/src/core/sessions/executions/interfaces.py
  • api/oss/src/core/sessions/inputs/service.py
  • api/oss/src/dbs/postgres/sessions/executions/dao.py
  • api/oss/tests/pytest/unit/sessions/test_session_inputs_dao.py

Included review availability: Your plan provides up to 8 included reviews per hour; 2 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved session admission when an approved continuation exists but stream state has not yet caught up.
    • Nonterminal continuations now remain pending against the approved child execution instead of starting a duplicate execution.
    • Terminal continuations continue to allow immediate execution.
    • Behavior is covered for both queue and steer policies across pending, running, recoverable, and terminal states.

Walkthrough

The session admission flow now locks an unsettled continuation when a terminal source execution has no promoted successor. PostgreSQL returns the locked continuation, and parameterized tests verify queue and steer behavior across continuation states.

Changes

Continuation admission flow

Layer / File(s) Summary
Active continuation locking
api/oss/src/core/sessions/executions/interfaces.py, api/oss/src/dbs/postgres/sessions/executions/dao.py
The executions DAO interface and PostgreSQL implementation add transaction-scoped locking for the first nonterminal continuation.
Admission fallback wiring
api/oss/src/core/sessions/inputs/service.py
Terminal-source admission uses the locked continuation as the successor. It falls through to execute admission when no continuation exists.
Admission behavior validation
api/oss/tests/pytest/unit/sessions/test_session_inputs_dao.py
Parameterized tests cover queue and steer policies across terminal, pending-delivery, running, and recoverable continuation states.

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

Merge Risk: ⚪ Minimal · up to 19b00

Queued input now remains behind an approved continuation while it is active, while terminal continuations still allow a new execution. No concrete current-head merge risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant SessionInputsService
  participant SessionExecutionsDAO
  participant PostgreSQL
  participant ExecuteAdmission

  SessionInputsService->>SessionExecutionsDAO: Check for promoted successor
  SessionInputsService->>SessionExecutionsDAO: Lock active continuation
  SessionExecutionsDAO->>PostgreSQL: Query and lock nonterminal continuation
  PostgreSQL-->>SessionExecutionsDAO: Return continuation or none
  alt Continuation found
    SessionExecutionsDAO-->>SessionInputsService: Return successor execution ID
  else No continuation found
    SessionInputsService->>ExecuteAdmission: Fall through to execute admission
  end
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: queued input remains behind approval continuations that are starting.
Description check ✅ Passed The description directly explains the admission fix, continuation locking behavior, terminal fallback, and validation results.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-1152-resume-queue

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.

@mmabrouk

mmabrouk commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-09-06T02:51:59.801Z

@mmabrouk

mmabrouk commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

Release QA classification of web acceptance run 34005750471 on 19b0077c6e:

Both attempts failed during chat-app setup with response.text: Protocol error (Network.getResponseBody): No resource with given identifier found. The recorded retry points to apiHelpers/index.ts:162 and contains zero /invoke requests. This is the stale-document app-lookup fixture race fixed by #6595, rather than a failed execution of this PR’s queue-admission behavior.

The final combined candidate cf9a974f42 includes the reviewed fixture head 9623488b6c; this stacked PR head does not. That fixture correction passed 7 focused helper tests and the exact failing chat acceptance against Railway/mock in 38.8 seconds, with completed CodeRabbit review. The separate provider-propagation condition was not observed in this failure. No blind rerun was performed, and this comment does not relabel the historical workflow as passing.

— Codex (release QA)

@mmabrouk
mmabrouk changed the base branch from fix/release-1152-queue-paused-approval to release/v0.115.2 September 6, 2026 02:51
@mmabrouk
mmabrouk merged commit 9f090e8 into release/v0.115.2 Sep 6, 2026
67 of 69 checks passed
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