fix(api): keep queued messages behind pending approvals - #6598
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🤖 The AI agent says: @coderabbitai review Please review exact commit 094ee60. Focus on Queue preserving an unanswered approval, the execution/interaction lock ordering, and re-admission outside the transaction when approval wins the race. Steer remains intentional. Root and independent review passed; 16 unit tests and one real local approval→Queue→approved tool→queued completion journey passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review. 📝 SummarySummary by CodeRabbit
Walkthrough
ChangesPending approval admission
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to Queue inputs now remain behind unanswered approvals and resume in the approved continuation’s ordering, while steer and answered-approval behavior remain immediate. Current coverage supports merge readiness with no active merge-blocking risk. Sequence Diagram(s)sequenceDiagram
participant Client
participant SessionInputsService
participant SessionInteractionsDAO
participant ContinuationResumer
Client->>SessionInputsService: submit input
SessionInputsService->>SessionInteractionsDAO: fetch turn interactions
SessionInteractionsDAO-->>SessionInputsService: return interaction status
alt interaction is pending
SessionInputsService->>SessionInputsService: retry admission after interaction
SessionInputsService->>ContinuationResumer: defer input to approval continuation
else interaction is answered or absent
SessionInputsService-->>Client: admit input
end
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
commit='094ee6004cd36459ecefacc85bd538528a74db10'
git show --no-ext-diff --format=fuller --stat "$commit"
printf '\n===== NAME STATUS =====\n'
git diff-tree --no-commit-id --name-status -r "$commit"
printf '\n===== DIFF =====\n'
git diff --no-ext-diff --find-renames "${commit}^" "$commit" -- .
printf '\n===== OUTLINES =====\n'
git diff-tree --no-commit-id --name-only -r "$commit" |
while IFS= read -r file; do
case "$file" in
*.py)
printf '\n--- %s ---\n' "$file"
ast-grep outline "$file" --items all || true
;;
esac
doneLength of output: 36150 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '===== ADMISSION SERVICE ====='
nl -ba api/oss/src/core/sessions/inputs/service.py | sed -n '1,250p'
printf '%s\n' '===== INPUT DAO / INTERFACE ====='
fd -a -t f '^(dao|interfaces)\.py$' api/oss/src | \
while IFS= read -r f; do
if rg -q 'class SessionInputsDAO|SessionInputsDAOInterface|def transaction|async def transaction' "$f"; then
printf '\n--- %s ---\n' "$f"
rg -n -C 8 'class SessionInputsDAO|SessionInputsDAOInterface|def transaction|async def transaction|create_input|fetch_active_successor' "$f"
fi
done
printf '%s\n' '===== EXECUTION / INTERACTION LOCK IMPLEMENTATIONS ====='
rg -n -C 10 --glob '*.py' \
'async def lock_for_control|def lock_for_control|async def fetch_turn_interactions|def fetch_turn_interactions|for_update' \
api/oss/src
printf '%s\n' '===== APPROVAL / INTERACTION RESOLUTION AND CONTINUATION RESUME ====='
rg -n -C 12 --glob '*.py' \
'resolve.*interaction|respond.*interaction|SessionInteractionStatus\.(responded|resolved)|resume_recoverable_continuation|fetch_turn_interactions' \
api/oss/src/core/sessions api/oss/src/apis api/oss/src/dbs
printf '%s\n' '===== SERVICE CONSTRUCTION / DIRECT INSTANTIATIONS ====='
rg -n -C 4 --glob '*.py' \
'SessionInputsService\s*\(' \
.Length of output: 1667 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '===== ADMISSION SERVICE ====='
awk '{printf "%6d %s\n", NR, $0}' api/oss/src/core/sessions/inputs/service.py | sed -n '1,250p'
printf '%s\n' '===== INPUT DAO / INTERFACE ====='
fd -a -t f '^(dao|interfaces)\.py$' api/oss/src |
while IFS= read -r f; do
if rg -q 'class SessionInputsDAO|SessionInputsDAOInterface|def transaction|async def transaction' "$f"; then
printf '\n--- %s ---\n' "$f"
rg -n -C 8 'class SessionInputsDAO|SessionInputsDAOInterface|def transaction|async def transaction|create_input|fetch_active_successor' "$f" || true
fi
done
printf '%s\n' '===== EXECUTION / INTERACTION LOCK IMPLEMENTATIONS ====='
rg -n -C 10 --glob '*.py' \
'async def lock_for_control|def lock_for_control|async def fetch_turn_interactions|def fetch_turn_interactions|for_update' \
api/oss/src || true
printf '%s\n' '===== APPROVAL / INTERACTION RESOLUTION AND CONTINUATION RESUME ====='
rg -n -C 12 --glob '*.py' \
'resolve.*interaction|respond.*interaction|SessionInteractionStatus\.(responded|resolved)|resume_recoverable_continuation|fetch_turn_interactions' \
api/oss/src/core/sessions api/oss/src/apis api/oss/src/dbs || true
printf '%s\n' '===== SERVICE CONSTRUCTION / DIRECT INSTANTIATIONS ====='
rg -n -C 4 --glob '*.py' \
'SessionInputsService\s*\(' \
. || trueLength of output: 153436 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '===== INPUT DAO: CREATE AND PROMOTION ====='
sed -n '20,115p' api/oss/src/dbs/postgres/sessions/inputs/dao.py
sed -n '225,285p' api/oss/src/dbs/postgres/sessions/inputs/dao.py
printf '%s\n' '===== COMMAND RESPONSE TRANSACTION ====='
sed -n '466,710p' api/oss/src/core/sessions/commands/service.py
printf '%s\n' '===== CONTINUATION RESUME ====='
sed -n '790,930p' api/oss/src/core/sessions/commands/service.py
printf '%s\n' '===== PENDING-INPUT PROMOTION CALL SITES ====='
rg -n -C 10 --glob '*.py' \
'\b(promote_next|claim_next|promote_input|promote_pending|fetch_active_successor)\s*\(' \
api/oss/src
printf '%s\n' '===== TESTS: EXISTING POSTGRES SETTLEMENT RACES ====='
sed -n '300,435p' api/oss/tests/pytest/unit/sessions/test_session_inputs_dao.py
printf '%s\n' '===== CHANGED TEST SUPPORT ====='
sed -n '1,120p' api/oss/tests/pytest/unit/sessions/test_pending_inputs_service.pyLength of output: 44542
I found no issues in the requested paths.
✅ Action performedReview finished.
|
Railway Preview Environment
Updated at 2026-09-06T02:51:37.280Z |
|
Release QA review of the failed web acceptance job in run 34003401964, on Both attempts failed during chat-app setup with This is the stale-document response race fixed in #6595: app lookup now uses the authenticated request context after navigation, scoped to the active project. The final fixture head Validation of the final fixture correction: 7 focused helper tests passed, the exact previously failing chat acceptance passed against Railway with the mock provider in 38.8 seconds, and completed CodeRabbit review covered — Codex (release QA) |
Context
Sending a queued message while an agent waited for approval started a new run and cancelled the unanswered approval. Admission treated the paused session as idle because its running heartbeat had stopped.
Changes
Queue now checks the current execution's durable pending interactions and saves the message as a pending input while the approval remains unanswered. It rechecks after acquiring the execution lock; if another client has approved in the meantime, admission resumes outside the transaction so the approved continuation retains ownership. Steer and ordinary idle Send retain their existing behavior.
Tests
What to QA
Open a session with a pending native approval in two clients. Queue a follow-up from the observer: the approval must remain answerable and the follow-up must appear in the queue. Approve the tool and verify it finishes before the queued follow-up runs. Repeat with approval and Queue submitted close together from separate clients.