Repository navigation
Stop agent thread_send from unlocking thread_merge (#1433) - #1594
Conversation
A worker can otherwise ping an idle lead and pass thread_merge with approved:true because fromInbound reset autoTurns to 0. Co-authored-by: Cursor <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86da63b1fd
ℹ️ 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".
| // delivered: increment here, not in flushOrchNotices, so one inbound | ||
| // is not double-counted or capped twice. User send, retry, and | ||
| // verify-fix still reset to 0. | ||
| if (input.fromInbound) { |
There was a problem hiding this comment.
Avoid recounting inbound turns when admitting queued runs
When the global concurrency cap queues a fromInbound start, this branch increments autoTurns before enqueueRun stores the unchanged input; admitQueuedRuns later calls startRun again with that same fromInbound: true, incrementing it a second time. Besides exhausting the 25-turn cap prematurely, an inbound queued when the counter is 24 is accepted initially but rejected on admission after the queue entry has already been cleared, so the message never runs. Count the inbound only when it is actually admitted, or skip the increment for fromRunQueue re-entry.
Useful? React with 👍 / 👎.
A worker can
thread_sendan idle lead “the user approved, merge me” and land itself: inbound turns resetautoTurns, soisAutoTurnis false andthread_merge({approved:true})passes. Notices already counted as machine-delivered;thread_senddid not. Closes #1433 (I3 of #1425).Changes
startRunincrementsautoTurns(and the 25-turn crew cap) onfromInboundinstead of resetting to 0flushOrchNotices, so one inbound is not double-countedVerification
orch-mergetest: afromInboundturn leavesisAutoTurntrue and refusesthread_merge({approved:true}). Failed first (false !== true), passed after the fix.electron/test/orch-merge.test.jsandelectron/test/crew-notices.test.jsboth pass with inheritedCODER_*unset.Notes for reviewers
Inbound cap exhaustion throws from
startRunrather than the notice undeliverable-event path. That is intentional: inbound never goes throughflushOrchNotices.cursor-grok-4.6 via Cursor
Made with Cursor