Skip to content

fix(qa): accept structured gateway restart outcomes#103681

Merged
steipete merged 1 commit into
mainfrom
codex/fix-qa-gateway-restart-outcome
Jul 10, 2026
Merged

fix(qa): accept structured gateway restart outcomes#103681
steipete merged 1 commit into
mainfrom
codex/fix-qa-gateway-restart-outcome

Conversation

@steipete

@steipete steipete commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Closes #103676

What Problem This Solves

Fixes an issue where the live runtime-parity release gate reported gateway restart recovery as failed when agent.wait returned the current structured restart or aborted terminal reason.

Why This Change Was Made

The scenario now accepts only those two canonical restart-owned stop reasons in addition to its existing ok, timeout, and legacy upgrade-path error forms. Recovery health, interrupted-marker deduplication, and exactly-once recovery delivery remain mandatory. The QA wait-result boundary now types and tests stopReason preservation.

User Impact

Release validation no longer false-fails a healthy gateway restart solely because current runtimes use structured terminal metadata. Runtime product behavior is unchanged.

Evidence

  • Reproduced on exact release-proof SHA 7b03a2ae201ab9c27dc3bc39569e97c9f9582360: OpenClaw returned status=error, stopReason=restart; Codex returned status=error, stopReason=aborted.
  • pnpm test extensions/qa-lab/src/scenario-catalog.test.ts extensions/qa-lab/src/suite-runtime-agent-process.test.ts: 65/65 passed on Blacksmith Testbox tbx_01kx5y7vzbyq4s1pb1nc2kdakj through the repository Crabbox wrapper.
  • pnpm check:changed: typecheck, lint, guards, and runtime import-cycle checks passed on the same Testbox.
  • Targeted oxfmt and git diff --check passed.
  • Fresh autoreview: clean, no accepted/actionable findings (overall: patch is correct, confidence 0.97).
  • Authenticated exact-head live runtime pair passed 1/1 on both OpenClaw and Codex at 29f0cb6b9872a88149aac9e882477f2609225392 using Blacksmith Testbox tbx_01kx5xy78gj59snb0ny0tqh2cx.
  • Hosted PR CI passed 43/43: https://github.com/openclaw/openclaw/actions/runs/29091415411

AI-assisted change; implementation and contracts were source-audited, including the direct Codex app-server interrupt contract.

@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: 29f0cb6b98

ℹ️ 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".

- expr: liveTurnTimeoutMs(env, 180000)
- assert:
expr: "waited.status === 'ok' || waited.status === 'timeout' || (waited.status === 'error' && (String(waited.error ?? '').includes('EmbeddedAttemptSessionTakeoverError') || String(waited.error ?? '').includes('AbortError') || String(waited.error ?? '').includes('This operation was aborted')))"
expr: "waited.status === 'ok' || waited.status === 'timeout' || (waited.status === 'error' && (waited.stopReason === 'restart' || waited.stopReason === 'aborted' || String(waited.error ?? '').includes('EmbeddedAttemptSessionTakeoverError') || String(waited.error ?? '').includes('AbortError') || String(waited.error ?? '').includes('This operation was aborted')))"

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.

P2 Badge Restrict aborted stopReason to the Codex cell

In the runtime-parity suite this same YAML runs once with forcedRuntime=openclaw and once with forcedRuntime=codex (extensions/qa-lab/src/suite.ts:847-888). OpenClaw distinguishes restart aborts from ordinary direct aborts: resolveAgentRunAbortLifecycleFields returns stopReason: "restart" only for restart abort reasons and "aborted" for other aborts (src/agents/run-termination.ts:60-78). With this unconditional branch, an OpenClaw regression that loses restart attribution or directly aborts the in-flight turn still passes this restart-recovery scenario as long as the follow-up turn works, so the release gate can miss the exact gateway-restart contract it is meant to protect. Gate aborted to the Codex forced-runtime cell (or otherwise verify restart ownership) instead.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Jul 10, 2026
@clawsweeper

clawsweeper Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 8:55 AM ET / 12:55 UTC.

Summary
The PR updates the live gateway-restart QA scenario and related QA typing/tests to accept structured agent.wait stop reasons.

PR surface: Source +1, Tests +14, Other 0. Total +15 across 4 files.

Reproducibility: yes. Current main deterministically rejects the reported structured results, and the issue supplies exact prior live outputs from both runtime cells; the after-fix path has not yet been demonstrated.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: extensions/qa-lab/src/scenario-catalog.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #103676
Summary: This PR is the explicit candidate fix for the linked open QA bug.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Make the structured stop-reason assertion runtime-specific.
  • [P1] Post redacted after-fix live output for both runtime cells.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR explicitly says the exact after-fix live OpenClaw/Codex rerun is still in progress; add redacted terminal output or a linked artifact, then update the PR body to trigger a fresh review or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging the unconditional aborted branch can make the OpenClaw runtime cell pass after an ordinary abort or loss of restart attribution, weakening the release gate's regression coverage.
  • [P1] The contributor has not yet supplied after-fix real behavior proof from the exact live OpenClaw/Codex runtime-pair scenario.

Maintainer options:

  1. Preserve runtime-specific restart checks (recommended)
    Restrict aborted to the Codex cell, keep restart mandatory for native OpenClaw, and update focused assertion coverage before merge.
  2. Pause for stronger contract proof
    Hold the PR until live runtime-pair output demonstrates that broader acceptance is necessary without weakening native restart validation.

Next step before merge

  • [P1] The contributor should address the narrow runtime-specific finding and add live proof; the protected maintainer label keeps this PR out of automated repair routing.

Security
Cleared: The patch is limited to QA assertions, typing, and tests and introduces no concrete security or supply-chain concern.

Review findings

  • [P2] Restrict aborted to the Codex runtime cell — qa/scenarios/runtime/gateway-restart-inflight-run.yaml:99
Review details

Best possible solution:

Use the forced-runtime fact in the scenario so native OpenClaw requires structured stopReason: "restart" while Codex may accept its canonical "aborted" outcome, preserving all legacy, health, deduplication, and exactly-once recovery checks.

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

Yes. Current main deterministically rejects the reported structured results, and the issue supplies exact prior live outputs from both runtime cells; the after-fix path has not yet been demonstrated.

Is this the best way to solve the issue?

No. Reading structured terminal metadata is the correct direction, but the current shared assertion accepts a generic native OpenClaw abort and should instead enforce each runtime's canonical restart outcome.

Full review comments:

  • [P2] Restrict aborted to the Codex runtime cell — qa/scenarios/runtime/gateway-restart-inflight-run.yaml:99
    This shared flow runs for both forced runtimes, but native OpenClaw reserves restart for restart-owned cancellation and uses aborted for ordinary aborts. Accepting aborted unconditionally can hide a native restart-attribution regression; branch on the forced runtime and keep restart mandatory for OpenClaw.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ea6aa1dc7591.

Label changes

Label changes:

  • add P2: This is a focused release-validation correctness bug with limited runtime-product blast radius.
  • add merge-risk: 🚨 automation: The broadened assertion can make the release QA gate pass without proving native OpenClaw restart attribution.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR explicitly says the exact after-fix live OpenClaw/Codex rerun is still in progress; add redacted terminal output or a linked artifact, then update the PR body to trigger a fresh review or ask a maintainer to comment @clawsweeper re-review.

Label justifications:

  • P2: This is a focused release-validation correctness bug with limited runtime-product blast radius.
  • merge-risk: 🚨 automation: The broadened assertion can make the release QA gate pass without proving native OpenClaw restart attribution.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR explicitly says the exact after-fix live OpenClaw/Codex rerun is still in progress; add redacted terminal output or a linked artifact, then update the PR body to trigger a fresh review or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +1, Tests +14, Other 0. Total +15 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 0 +1
Tests 2 26 12 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 4 28 13 +15

What I checked:

Likely related people:

  • RomneyDa: Converted QA scenarios to the current YAML architecture and has substantial recent history in the QA suite and runtime-parity surfaces. (role: QA scenario architecture contributor; confidence: high; commits: fef839407995, 253b784468c6, 04601ae81a6d; files: qa/scenarios/runtime/gateway-restart-inflight-run.yaml, extensions/qa-lab/src/suite.ts)
  • vincentkoc: Authored the recent agent.wait normalization, completion-status, and timeout handling used by the changed QA boundary. (role: QA wait-helper contributor; confidence: high; commits: d1b268f7f7f7, 5822e8074dc4, 1c63da09d87b; files: extensions/qa-lab/src/suite-runtime-agent-process.ts, extensions/qa-lab/src/suite-runtime-agent-process.test.ts)
  • ooiuuii: Introduced the restart ownership and terminal-precedence work that distinguishes restart cancellation from ordinary aborts. (role: restart lifecycle contributor; confidence: high; commits: d20fdf3b3842; files: src/agents/run-termination.ts, src/gateway/server-close.ts)
  • steipete: Authored the current runtime-parity expansion used by this scenario and has recent merged history on the termination path beyond proposing this PR. (role: recent runtime-parity contributor; confidence: high; commits: 7b03a2ae201a, f53346944db0; files: extensions/qa-lab/src/suite.ts, src/agents/run-termination.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head 29f0cb6b9872a88149aac9e882477f2609225392:

  • Authenticated live runtime-pair rerun passed gateway-restart-inflight-run 1/1 on both OpenClaw and Codex using Blacksmith Testbox tbx_01kx5xy78gj59snb0ny0tqh2cx.
  • The OpenClaw cell preserved the canonical restart interruption and recovered exactly once; the Codex cell preserved its canonical aborted interruption and recovered exactly once.
  • Focused QA Lab tests passed 65/65 and pnpm check:changed passed on Testbox tbx_01kx5y7vzbyq4s1pb1nc2kdakj.
  • Fresh autoreview was clean at confidence 0.97.
  • Hosted PR CI passed 43/43: https://github.com/openclaw/openclaw/actions/runs/29091415411

No proof gaps remain for this bounded QA release-gate repair.

@steipete
steipete merged commit 5a451f9 into main Jul 10, 2026
158 of 167 checks passed
@steipete
steipete deleted the codex/fix-qa-gateway-restart-outcome branch July 10, 2026 12:58
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

extensions: qa-lab maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: QA gateway restart rejects canonical structured abort outcomes

1 participant