Skip to content

fix: resolve interrupt scheduling race between embedded run and ReplyOperation registries - #65221

Closed
jetd1 wants to merge 28 commits into
openclaw:mainfrom
jetd1:fix/interrupt-scheduling-race
Closed

jetd1 wants to merge 28 commits into
openclaw:mainfrom
jetd1:fix/interrupt-scheduling-race

Conversation

@jetd1

@jetd1 jetd1 commented Apr 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

When a user message arrives during an active run in interrupt queue mode, the scheduling layer rejects it with "⚠️ Previous run is still shutting down" and the message is lost.

Root cause

Two registries track run activity: ACTIVE_EMBEDDED_RUNS (scheduling) and ReplyOperation (delivery). After abort:

  1. waitForEmbeddedPiRunEnd resolves when ACTIVE_EMBEDDED_RUNS.delete() fires
  2. But isEmbeddedPiRunActive() checks both registries via OR
  3. ReplyOperation.clearState() runs in the old runs finally block — not yet complete
  4. New message scheduling calls resolveBusyState() → isActive still true → rejected

Changes

1. Two-phase wait (waitForEmbeddedPiRunEnd)

After the embedded run handle is removed, chain waitForReplyRunEndBySessionId with remaining timeout budget so callers see a fully idle session.

2. Force-detach fallback (forceDetachEmbeddedRun)

When abort+wait times out, remove the old runs handle from ACTIVE_EMBEDDED_RUNS so a new run can register immediately. The old runs finally block detects handle mismatch → no-op.

3. Retry with force (agent-runner.ts)

On ReplyRunAlreadyActiveError, wait 500ms for the reply-op to clear, then retry with force: true. Only in interrupt mode — collect/followup modes preserve the existing run to avoid dropped assistant progress.

4. Reply-run-registry hardening

  • skipNotify option prevents premature waiter resolution during force-supersede
  • isReplaced branch returns immediately without mutating maps the replacement op may reference
  • Normal clear path iterates all waitKeysBySessionId aliases to remove stale entries after session rotation

Known Limitations

  • Tool execution continues after force-detach — tools run to natural completion. Framework-level abort race or per-tool signal handling is planned as a separate feature.
  • Steer messages during long tool execution are queued but not processed until the tool returns. Steer-aware tool yield is future work.
  • sessions_send HTTP connections cannot be cancelled after abort.

Tests

29 tests passing across 3 test files:

  • runs.test.ts: force-detach, isEmbeddedPiRunActiveForSessionKey, handle identity guard
  • get-reply-run-queue.test.ts: force-detach + direct return, force-detach failure fallback
  • reply-run-registry.test.ts: skipNotify, isReplaced branch, alias preservation during force-supersede

Related

Part of a 3-PR fix set for interrupt/steer message delivery:

AI Disclosure

  • AI-assisted (OpenClaw agent + Codex review)
  • Fully tested (29 tests across 3 test files)
  • Author understands all changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: 0aeeac6934

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Apr 12, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the interrupt-mode race where a new user message was dropped with "⚠️ Previous run is still shutting down" because the ACTIVE_EMBEDDED_RUNS scheduling registry and the ReplyOperation delivery registry could desync after an abort. The fix is a layered defense: a two-phase waitForEmbeddedPiRunEnd (embedded handle removal → reply-op clearance), a forceDetachEmbeddedRun escape hatch for timeout scenarios, createReplyOperation({ force: true }) to supersede any residual ReplyOperation, and three hardening additions to clearReplyRunState (skipNotify, object-identity isReplaced guard, and full alias cleanup).

  • There is a narrow gap: when the embedded run has already ended (removed from ACTIVE_EMBEDDED_RUNS) but the ReplyOperation hasn't cleared within the remaining timeout budget, forceDetachEmbeddedRun returns false and get-reply-run-queue.ts returns "still shutting down" — even though the downstream createReplyOperation({ force: true }) would supersede the stale op. See inline comment at get-reply-run-queue.ts:48–76. Requires post-run runReplyAgent work to outlast the timeout, so very unlikely in practice.

Confidence Score: 4/5

Safe to merge; the fix substantially narrows the race window and the remaining gap requires an extremely unlikely timeout scenario.

All P2 findings. The identified gap in get-reply-run-queue.ts (force-detach returns false when only a stale ReplyOperation remains) is a real correctness hole but extremely unlikely in practice given the 15-second timeout budget. Core logic changes in reply-run-registry.ts are well-reasoned and well-tested. Score of 4 rather than 5 to flag the gap for author awareness.

src/auto-reply/reply/get-reply-run-queue.ts lines 48–76 (force-detach fallback gap when embedded run already ended); src/auto-reply/reply/get-reply-run-queue.test.ts (three tests outside describe block).

Comments Outside Diff (1)

  1. src/auto-reply/reply/get-reply-run-queue.ts, line 48-76 (link)

    P2 Force-detach returns false when ReplyOperation is the only remaining blocker

    When the embedded run has already ended (removed from ACTIVE_EMBEDDED_RUNS) but the ReplyOperation hasn't cleared within waitForReplyRunEndBySessionId's timeout, forceDetachEmbeddedRun returns false (nothing to detach from the embedded registry). The code then falls through to the "still shutting down" reply, even though the downstream createReplyOperation({ force: true }) in agent-runner.ts would have cleared the stale ReplyOperation synchronously.

    Condition: interrupt mode + abort causes the embedded run to end quickly, but post-run work in runReplyAgent (payload building, usage persistence) extends beyond the remaining timeout budget. Rare in practice but represents the same message-loss failure the PR is fixing.

    A minimal fix: in interrupt mode, return continue for both detached === true and detached === false, letting createReplyOperation({ force: true }) own final cleanup in both cases:

    if (params.queueMode === "interrupt" && params.forceDetachActiveRun) {
      const detached = params.forceDetachActiveRun(params.activeSessionId);
      if (detached) {
        logVerbose(
          `Force-detached stale run for ${params.sessionKey ?? params.sessionId} after interrupt timeout`,
        );
      } else {
        // ACTIVE_EMBEDDED_RUNS already empty — only a stale ReplyOperation remains.
        // The downstream createReplyOperation({ force: true }) will supersede it.
        logVerbose(
          `forceDetach noop (embedded run already ended) for ${params.sessionKey ?? params.sessionId}; deferring to force-supersede`,
        );
      }
      await params.refreshPreparedState();
      return { kind: "continue", busyState: params.resolveBusyState() };
    }
    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/auto-reply/reply/get-reply-run-queue.ts
    Line: 48-76
    
    Comment:
    **Force-detach returns `false` when `ReplyOperation` is the only remaining blocker**
    
    When the embedded run has already ended (removed from `ACTIVE_EMBEDDED_RUNS`) but the `ReplyOperation` hasn't cleared within `waitForReplyRunEndBySessionId`'s timeout, `forceDetachEmbeddedRun` returns `false` (nothing to detach from the embedded registry). The code then falls through to the "still shutting down" reply, even though the downstream `createReplyOperation({ force: true })` in `agent-runner.ts` would have cleared the stale `ReplyOperation` synchronously.
    
    Condition: interrupt mode + abort causes the embedded run to end quickly, but post-run work in `runReplyAgent` (payload building, usage persistence) extends beyond the remaining timeout budget. Rare in practice but represents the same message-loss failure the PR is fixing.
    
    A minimal fix: in interrupt mode, return `continue` for both `detached === true` and `detached === false`, letting `createReplyOperation({ force: true })` own final cleanup in both cases:
    
    ```typescript
    if (params.queueMode === "interrupt" && params.forceDetachActiveRun) {
      const detached = params.forceDetachActiveRun(params.activeSessionId);
      if (detached) {
        logVerbose(
          `Force-detached stale run for ${params.sessionKey ?? params.sessionId} after interrupt timeout`,
        );
      } else {
        // ACTIVE_EMBEDDED_RUNS already empty — only a stale ReplyOperation remains.
        // The downstream createReplyOperation({ force: true }) will supersede it.
        logVerbose(
          `forceDetach noop (embedded run already ended) for ${params.sessionKey ?? params.sessionId}; deferring to force-supersede`,
        );
      }
      await params.refreshPreparedState();
      return { kind: "continue", busyState: params.resolveBusyState() };
    }
    ```
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/get-reply-run-queue.ts
Line: 48-76

Comment:
**Force-detach returns `false` when `ReplyOperation` is the only remaining blocker**

When the embedded run has already ended (removed from `ACTIVE_EMBEDDED_RUNS`) but the `ReplyOperation` hasn't cleared within `waitForReplyRunEndBySessionId`'s timeout, `forceDetachEmbeddedRun` returns `false` (nothing to detach from the embedded registry). The code then falls through to the "still shutting down" reply, even though the downstream `createReplyOperation({ force: true })` in `agent-runner.ts` would have cleared the stale `ReplyOperation` synchronously.

Condition: interrupt mode + abort causes the embedded run to end quickly, but post-run work in `runReplyAgent` (payload building, usage persistence) extends beyond the remaining timeout budget. Rare in practice but represents the same message-loss failure the PR is fixing.

A minimal fix: in interrupt mode, return `continue` for both `detached === true` and `detached === false`, letting `createReplyOperation({ force: true })` own final cleanup in both cases:

```typescript
if (params.queueMode === "interrupt" && params.forceDetachActiveRun) {
  const detached = params.forceDetachActiveRun(params.activeSessionId);
  if (detached) {
    logVerbose(
      `Force-detached stale run for ${params.sessionKey ?? params.sessionId} after interrupt timeout`,
    );
  } else {
    // ACTIVE_EMBEDDED_RUNS already empty — only a stale ReplyOperation remains.
    // The downstream createReplyOperation({ force: true }) will supersede it.
    logVerbose(
      `forceDetach noop (embedded run already ended) for ${params.sessionKey ?? params.sessionId}; deferring to force-supersede`,
    );
  }
  await params.refreshPreparedState();
  return { kind: "continue", busyState: params.resolveBusyState() };
}
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/auto-reply/reply/get-reply-run-queue.test.ts
Line: 88-170

Comment:
**New tests placed outside any `describe` block**

The three new test cases (lines 88–170) are at module top-level while the pre-existing tests live inside `describe("resolvePreparedReplyQueueState", ...)`. Grouping them inside the same describe (or a sibling one) keeps the test file scannable and the reporter output consistent.

```suggestion
describe("resolvePreparedReplyQueueState – interrupt force-detach", () => {
  it("force-detaches in interrupt mode when still busy after wait", async () => {
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: resolve interrupt scheduling race b..." | Re-trigger Greptile

@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch from 0aeeac6 to e8c7333 Compare April 12, 2026 07:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: e8c73338f5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/pi-embedded-runner/runs.ts Resolved
@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch from e8c7333 to 3f12b2f Compare April 12, 2026 07:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: 3f12b2f94f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/pi-embedded-runner/runs.ts Resolved
@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch 2 times, most recently from 289a202 to b9296a9 Compare April 12, 2026 10:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: b9296a93eb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch from b9296a9 to ec6f843 Compare April 12, 2026 10:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: ec6f843ba2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/auto-reply/reply/agent-runner.ts Resolved
@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch from ec6f843 to d754b46 Compare April 12, 2026 10:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: d754b46c1f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch from d754b46 to b8d1141 Compare April 12, 2026 11:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: b8d1141544

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/auto-reply/reply/agent-runner.ts Resolved
@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch from b8d1141 to fee13b8 Compare April 12, 2026 11:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: fee13b89b6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/auto-reply/reply/agent-runner.ts Resolved
@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch 2 times, most recently from a7b076f to 64a0c1c Compare April 17, 2026 10:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: 64a0c1c209

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/auto-reply/reply/agent-runner.ts Resolved
@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch from 64a0c1c to 875a8d5 Compare April 17, 2026 12:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: 875a8d5adb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/auto-reply/reply/agent-runner.ts Resolved
@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch from 875a8d5 to 701e034 Compare April 17, 2026 14:15
steipete and others added 9 commits April 21, 2026 16:17
…dit (openclaw#69581)

* fix(codex): exclude codex-app-server synthetic apiKey from secrets audit

The Codex extension uses the literal string "codex-app-server" as a
hardcoded placeholder apiKey in provider.ts, since the real
authentication is managed by the app-server transport itself.

The secrets audit currently reports this as a real plaintext leak
(PLAINTEXT_FOUND), producing a false positive for any user who has
configured the Codex harness.

Declare it as a plugin-owned non-secret marker in the Codex plugin
manifest, so it flows through the standard
`listKnownNonSecretApiKeyMarkers()` path alongside `ollama-local`,
`lmstudio-local`, `gcp-vertex-credentials`, and `minimax-oauth`.

Also extends the existing `model auth markers` unit tests to lock
in the behavior.

Fixes openclaw#69511

* ci: retrigger checks (no-op)

(cherry picked from commit 081da17)
openclaw#69338)

When ingestDelta returns null (first empty/commentary delta or unchanged
content), the handler returned early, skipping setActivityStatus and
armStreamingWatchdog. If all subsequent deltas were also null (e.g.
due to phase filtering), the watchdog was never armed and the status bar
stayed stale as "idle" while a run was live.

Move setActivityStatus("streaming") and armStreamingWatchdog before
the null-displayText guard so they fire on every received delta event.

Fixes openclaw#34513, openclaw#40824

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
(cherry picked from commit 89b6d02)
@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch from 701e034 to eb0d04b Compare April 22, 2026 15:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: eb0d04b3ce

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// identity gate additionally covers the "newer op still
// running at retry" edge where seq advanced but the
// registered object is not our stale one.
force: waitInterrupted && staleReplyOperation ? { ifStale: staleReplyOperation } : false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Tie forced retry to the timed-out operation

force is derived from waitInterrupted plus the operation currently in the registry, but waitInterrupted only tells us that an earlier wait timed out, not that the currently active operation is that same stale run. In interrupt bursts, request A can time out on old run O, then collide with newer run B and set force: { ifStale: B }, which lets A abort B on retry and run out of order (dropping newer user input). Fresh evidence in this commit is that the retry force token is built from replyRunRegistry.get(...) at catch time rather than from the specific run that timed out.

Useful? React with 👍 / 👎.

…Operation registries

- Rename forceDetached → waitInterrupted for clarity: the flag indicates
  whether the waitForActiveRunEnd was forcefully interrupted, not whether
  a detach operation succeeded.
- Two-phase abort: interrupt → waitForEmbeddedPiRunEnd → refreshPreparedState
  → check isActive; if still active, attempt forceDetachActiveRun.
- forceDetachActiveRun return value is advisory — scheduling layer commits
  to superseding regardless; createReplyOperation handles residual
  ReplyOperation state.
- Stale waiter cleanup: forceDetachActiveRun resolves waiters with false
  immediately to prevent leakage.
- Identity-gated force-supersede: createReplyOperation's force now accepts
  `{ ifStale: ReplyOperation }`. At the interrupt-retry site in
  agent-runner, the stale ReplyOperation is captured synchronously in the
  ReplyRunAlreadyActiveError catch, then the retry passes the ref so the
  force only fires when the registered op is object-identical to the
  original stale one. If a newer request registered during the 500ms wait
  window, the retry throws and we return "try again" instead of
  preempting the legitimate newer run.
- Creation sequence counter: reply-run-registry tracks a monotonic per-
  sessionKey createSeq incremented on every successful createReplyOperation.
  The interrupt-retry path captures staleSeq alongside staleReplyOperation
  and rejects the retry when seq advanced during its wait. Closes the
  window where a newer request supersedes the stale run AND completes
  before the older retry wakes — identity-gate alone can't detect that
  case because the registry is empty again by retry time.
@jetd1
jetd1 force-pushed the fix/interrupt-scheduling-race branch from eb0d04b to ae72379 Compare April 22, 2026 17:26
@jetd1
jetd1 requested review from a team as code owners April 22, 2026 17:26
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord gateway Gateway runtime cli CLI command changes scripts Repository scripts docker Docker and sandbox tooling extensions: qa-lab extensions: codex labels Apr 22, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

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: ae72379c7b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// (nothing in the registry to compare against). The seq
// check rejects the retry and returns "try again" instead of
// running our older input out of order.
const staleReplyOperation = replyRunRegistry.get(replySessionKey ?? "");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Tie forced retry to the timed-out operation identity

The retry force token is taken from replyRunRegistry.get(...) after the first ReplyRunAlreadyActiveError, so in interrupt mode a request that timed out on an older run can end up force-superseding a newer run that already took over. In a burst (waitInterrupted === true), if request A times out on stale run O and request B registers before A reaches this catch block, staleReplyOperation becomes B and the retry uses force: { ifStale: B }, allowing A to abort B and run out of order (dropping newer input).

Useful? React with 👍 / 👎.

@vincentkoc vincentkoc added the triage: dirty-candidate Candidate: broad unrelated surfaces; may need splitting or cleanup. label Apr 26, 2026
@vincentkoc vincentkoc self-assigned this Apr 29, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Thanks for the fix attempt. Closing this because the branch is dirty/XL and spans generated docs, Discord, gateway, qa-lab, scripts, and agents; please resubmit the interrupt scheduling race fix as a clean narrow PR with the repro/validation.

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

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord cli CLI command changes docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: codex extensions: qa-lab gateway Gateway runtime scripts Repository scripts size: XL triage: dirty-candidate Candidate: broad unrelated surfaces; may need splitting or cleanup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants