Skip to content

fix: stop stalled GitHub requests from hanging Code Mode turns - #200927

Merged
steipete merged 1 commit into
mainfrom
codex/codemode-github-handoff-deadline
Nov 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/codemode-github-handoff-deadline

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

A Code Mode exec awaiting github_publish can remain in its callValue bridge until the reply watchdog stops the turn when a Gateway request never settles.

User Impact

Stalled direct GitHub requests now return a catchable timeout after ten minutes. Publication receipts and yielding handoffs keep their existing contracts. A response timeout does not undo accepted work: inspect the existing publication before retrying.

Why This Change Was Made

On base 08df47114b98, src/agents/tools/github-publish-tool.ts:611 awaits a direct publication without a timeout. src/agents/tools/in-process-gateway.ts:491 converts an omitted timeout to null, leaving the in-process wait unbounded. The same gap affects the other direct actions without an explicit limit.

Bound the whole direct request promise at the GitHub tool owner with the existing non-cancelling waitForGatewayDispatch helper, including preparation before handler dispatch. Reuse the existing 600,000 ms preparation budget and preserve explicit action timeouts. Yielding preparation and local-checkout publication are already direct-only; their receipts and later session resumption remain unchanged. The incident's exact action remains unknown; this fixes the reproduced missing-deadline path.

Evidence

The regression uses real Node and QuickJS workers, the Code Mode bridge, and the subscribed tool runtime, with a Gateway request held pending. On base, both cases fail after 600,001 simulated milliseconds because exec still has no result. With the fix, both return the catchable Gateway timeout without another request.

  • Red on 08df47114b984cc47afd874e18964c21e2ff7350: 2 failed, expected undefined to match object { status: 'completed' }.
  • Green: 42 passed across the new bridge regression, existing GitHub tool tests, and all nine handoff lifecycle cases.
  • Production and agent-tool test typechecks, targeted lint/format, and git diff --check pass.
  • pnpm build passes, including Code Mode workers.
  • Codex autoreview, P0–P2, against the local candidate based on 08df47114b98: scoped-clean, no actionable findings. The reviewed source is committed unchanged.

New regression timing: 2.013 s test time, 25.66 s wall in the final focused run; all three focused suites took 199.79 s including worker compilation. CI timing is pending. The change adds 7 net production lines and 83 test lines, reusing the existing deadline owner without new state or a bridge-specific policy.

Bound direct GitHub tool requests before Gateway preparation so a stalled request returns to Code Mode instead of waiting for the reply watchdog. Reuse the existing non-cancelling response deadline and preserve handoff receipts and later session resumption. Timed-out accepted work may still finish; inspect existing publication state before retrying.
@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Nov 18, 2026
@steipete
steipete marked this pull request as ready for review November 18, 2026 02:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T02:27:25.153086Z 06d00b3 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 18, 2026
@steipete
steipete enabled auto-merge (squash) November 18, 2026 02:40
@clawsweeper

clawsweeper Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR gives direct GitHub tool requests a ten-minute response deadline while preserving explicit timeouts and yielding handoffs.

Example: Code Mode awaits github_publish({}) and its Gateway request never settles.

  • Before: The bridge remains pending until the reply watchdog stops the turn.
  • After: After 600,000 ms, guest code can catch the Gateway timeout; already accepted work may still finish.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and source-consistent, but mocked request evidence does not satisfy the required real-behavior proof.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A Code Mode turn awaiting a stalled GitHub request cannot receive a catchable failure and is eventually stopped by the reply watchdog.
Reason: A bounded response restores useful failure handling through existing owners; the supplied maintainer-authored direction settles the product choice.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it narrowly fixes a source-confirmed unbounded GitHub request wait still present on current main, with no concrete introduced correctness defect found.

Priority: P2
Reviewed head: 06d00b3c3ad6acd83316af9940279e2a7fced38f

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted terminal output or logs from an isolated Gateway with a real agent showing a stalled direct github_publish request returning a catchable timeout through Code Mode.
Agent review details

How this fits together

The GitHub agent tool translates session-scoped actions into Gateway requests and returns publication receipts or action results to direct callers and Code Mode.

flowchart TD
  A[Code Mode guest] --> B[GitHub agent tool]
  B --> C[Bounded response wait]
  C --> D[Gateway request]
  D --> E[Receipt or action result]
  C --> F[Catchable timeout]
Loading

Technical review

Best possible solution:

Keep the deadline at the existing GitHub tool owner, reusing non-cancelling dispatch waits while preserving receipts, idempotency, and yielding handoffs.

Do we have a high-confidence way to reproduce the issue?

The current-main call chain demonstrably permits an unbounded in-process publication wait, and the PR reports red-on-base bridge regressions; this review did not execute target code.

Is this the best way to solve the issue?

The patch is the smallest complete repair shown: bound direct requests once at their existing owner, reuse the established deadline helper, and retain the separately owned handoff lifecycle.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0ca4e7d3db4b.

Provenance checked

  • Gateway-owned GitHub publication keeps the original intent (0606e31: Broker publication through Gateway-held credentials and durable receipts instead of exposing forge credentials to workers.)
  • Preparation budgets and yielding handoffs keeps the original intent (feat: prepare existing PRs from ordinary chats #178756: Allow an ordinary unbound conversation to prepare an existing PR through a yielded workspace-adoption lifecycle.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0606e31 adds src/agents/tools/github-publish-tool.ts:36 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0606e31d0e62; files: src/agents/tools/github-publish-tool.ts)

PR surface

Source +7, Tests +83. Total +90 across 2 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 11 4 +7
Tests 1 83 0 +83
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 94 4 +90

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Direct response deadline 600,000 ms default; existing explicit action limits retained Previously unbounded direct waits become bounded without adding a user configuration option.

Labels

Label changes:

  • add P2: A stalled GitHub request can consume an agent turn, but the exact incident action is unknown and the demonstrated defect has a limited request-specific scope.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A stalled GitHub request can consume an agent turn, but the exact incident action is unknown and the demonstrated defect has a limited request-specific scope.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 17, 2026, 9:42 PM ET / November 18, 2026, 02:42 UTC.

@steipete
steipete merged commit 7ff0d90 into main Nov 18, 2026
200 of 201 checks passed
@steipete
steipete deleted the codex/codemode-github-handoff-deadline branch November 18, 2026 02:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
Bound direct GitHub tool requests before Gateway preparation so a stalled request returns to Code Mode instead of waiting for the reply watchdog. Reuse the existing non-cancelling response deadline and preserve handoff receipts and later session resumption. Timed-out accepted work may still finish; inspect existing publication state before retrying.
RomneyDa added a commit that referenced this pull request Nov 19, 2026
Bound direct GitHub tool requests before Gateway preparation so a stalled request returns to Code Mode instead of waiting for the reply watchdog. Reuse the existing non-cancelling response deadline and preserve handoff receipts and later session resumption. Timed-out accepted work may still finish; inspect existing publication state before retrying.

(cherry picked from commit 7ff0d90)

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
Bound direct GitHub tool requests before Gateway preparation so a stalled request returns to Code Mode instead of waiting for the reply watchdog. Reuse the existing non-cancelling response deadline and preserve handoff receipts and later session resumption. Timed-out accepted work may still finish; inspect existing publication state before retrying.

Release adaptation: Adapt gateway binding to existing readiness branch, preserving validation. Source regression omits unavailable watchdog fixture.

(cherry picked from commit 7ff0d90)

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant