Skip to content

fix(qa): require a fresh reply and real tool use after switching models - #119662

Merged
vincentkoc merged 14 commits into
mainfrom
codex/autoqa-model-switch-authentic-evidence-20260805
Aug 7, 2026
Merged

vincentkoc merged 14 commits into
mainfrom
codex/autoqa-model-switch-authentic-evidence-20260805

Conversation

@steipete

@steipete steipete commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Model-switch QA could falsely pass when evidence from a prior reply or attempt was mistaken for evidence from the exact run that selected the alternate model. The original contribution and investigation are credited to @steipete.

Root Cause

The inherited implementation inferred ownership from transcript cursors and persisted history. That could not prove that a delayed result, effective model, successful tool call, or visible terminal reply belonged to the current run.

Independent follow-up review found a second producer-boundary bug: the terminal receipt treated any tool metadata without isError: true as successful. Start-only or otherwise nonterminal metadata could therefore satisfy model-switch tool continuity without an observed successful completion.

A later review found one remaining split-outcome case: approval-unavailable is correctly normalized as observerIsError: true, while isToolError intentionally remains false to preserve recovery-oriented approval UX. Built-in receipt metadata used the presentation/recovery flag and therefore certified an exec that never ran.

Independent exact-head review then found that receipt visibility was derived from truthiness of finalAssistantVisibleText. Canonical exact NO_REPLY is silent, but the raw marker is truthy, so both model-switch scenarios could falsely accept a deliberately silent terminal.

The latest independent reviews found that delivery ownership was still split between exact-run terminal evidence and QA-bus observations. Alternate-run continuity initially depended on post-cursor bus text, while the follow-up scenario's primary step still accepted any outbound message for the operator. Neither bus text nor a cursor proves which run delivered the reply.

The delivery lifecycle already owns the authoritative result. It now records a bounded terminalDelivery snapshot containing only normalized status and aggregate result count, including the strict-delivery callback-before-throw path. Both primary and alternate scenario runs must provide their own visible reply, exact receipt, and sent delivery evidence with a positive result count.

The architectural owners are:

  • provider/plugin adapters, which observe the effective response model and Codex reroute event;
  • the agent terminal boundary, which owns run/session/turn identity and terminal disposition;
  • QA Lab, which consumes that run-owned receipt without inspecting provider internals or storage.

Canonical Fix

  • Add one internal terminal receipt containing exact run/session/turn identity, requested provider/model, effective provider/model and AssistantMessage.responseModel, successful tool names, reroute state, and visible terminal disposition.
  • Propagate direct OpenAI terminal response.model.
  • Project current-turn Codex model/rerouted into the terminal assistant response model.
  • Return the receipt through existing agent lifecycle and agent.wait paths.
  • Expose the existing canonical agent.wait.terminalReply as a bounded QA wait-result union.
  • Capture bounded run-owned terminalDelivery at the delivery callback and project it independently through lifecycle, gateway job state, agent.wait, and QA Lab.
  • Require both primary and alternate model-switch runs to provide exact-run terminal receipts, visible terminal replies where consumed, and terminalDelivery.status === "sent" with a positive resultCount.
  • Evaluate continuity and step details from the exact run's terminalReply.text; do not use QA-bus text or cursors for ownership or delivery certification.
  • Reject normalized-identical primary/alternate references before execution.
  • Preserve fresh-visible-reply and successful-tool-result checks.
  • Preserve the shared isError tri-state across every harness producer: false for an observed successful completion, true for terminal failure, and absent for started/running/unknown native state.
  • Record finalized built-in receipt metadata from the normalized observer outcome, including successful calls whose result payload represents async/running work, while retaining isToolError for recovery and presentation; record Copilot tool.execution_complete booleans while keeping start-only metadata unknown; audit Codex native completion status before setting a boolean.
  • Count only isError === false entries as successful terminal tool evidence.
  • Leave receipt disposition unset during attempt preparation and finalize it in run-entry from the canonical terminal reply snapshot, so NO_REPLY and empty terminals are not-visible.
  • Remove cursor-based and QA-bus text ownership inference. No evidence schema v2, public SDK/protocol, config, storage, or SQLite change.

Service-tier certification is explicitly out of scope for this PR.

Rebase and Scope

  • Source branch: codex/autoqa-model-switch-authentic-evidence-20260805
  • Original source head: d0d3273e1c3e2b0f739ba8aeeb8f5ec3dbf19d3a
  • Rebased base: 01cc71060d6c57eff142cfc210685c651ccb6397
  • Published head: 720a252555fac8aa4dfc710be28d1de23e2d7df0
  • Current main at publication preflight: c25671cf275a4b5a339db182a5ba8bffc2e73c11 with zero touched-file overlap and a clean merge-tree.

LOC versus merge base 01cc71060d6c57eff142cfc210685c651ccb6397:

  • Runtime production: +182/-21, net +161
  • QA production/plumbing: +109/-75, net +34
  • Tests: +833/-16, net +817

Run-owned terminal-delivery correction 89598fab1bf4f6eba61305887d52bb89073e5c11:

  • Runtime production: +64/-2, net +62
  • QA production/plumbing: +20/-53, net -33
  • Tests: +313/-165, net +148

Primary-run delivery binding correction 720a252555fac8aa4dfc710be28d1de23e2d7df0:

  • QA production/plumbing: +10/-8, net +2
  • Tests: +72/-15, net +57

Codex Contract Checked

Sibling Codex source was inspected at a7dcd20d3895ec4c9cbdde534745bbffbc2d2e28:

  • codex-rs/app-server-protocol/src/protocol/v2/model.rs:137-146
  • codex-rs/protocol/src/protocol.rs:1949-1954
  • codex-rs/core/src/session/mod.rs:3126-3153
  • codex-rs/app-server/src/bespoke_event_handling.rs:351-361
  • codex-rs/app-server/tests/suite/v2/safety_check_downgrade.rs:344-379

These establish that model/rerouted carries thread/turn ownership plus requested/effective models, and is emitted before turn/completed.

Tool terminal ownership was also checked directly:

  • codex-rs/app-server/README.md:1445, 1481-1482, 1548-1552, 1680-1683
  • codex-rs/protocol/src/items.rs:164-180, 241-264, 415-422
  • codex-rs/core/src/tools/handlers/dynamic.rs:196-244

These establish that Codex start events are nonterminal, while completed command/dynamic/MCP items carry the explicit terminal status or success fact used by the adapter.

Other Producer Contracts Checked

  • packages/agent-core/src/types.ts:32-33, 321-322, 622-628
  • packages/agent-core/src/agent-loop.ts:1524-1537
  • @github/[email protected] dist/generated/session-events.d.ts:3978-4051, 4186-4257

The built-in loop emits tool_execution_end only after finalization with a required boolean. Copilot separates start from completion and supplies a required completion success boolean.

Evidence

Historical contributor proof on the pre-repair head remains useful context: 126 focused tests and two mock-provider model-switch scenarios passed in Blacksmith Actions run https://github.com/openclaw/openclaw/actions/runs/31030726338. That proof did not close the cursor-ownership gap and is superseded for the final verdict.

Current and historical proof:

  • Focused local suites: 191 tests passed across OpenAI response handling, terminal receipt/lifecycle, gateway wait, Codex projection, model-switch scenarios, suite summary, and runtime parity.
  • Final affected reruns: QA runtime flow 2/2; Codex assistant projection 13/13.
  • Follow-up review correction: 394 focused tests passed across receipt normalization, built-in tools, Codex native/dynamic projection, Copilot event/attempt projection, and both model-switch continuity proofs.
  • Approval-unavailable correction: the new regression failed before the fix with toolMetas.isError: false, then 147 full handler tests and 11 terminal-preparation tests passed. Targeted oxfmt, oxlint, and git diff --check passed.
  • Canonical NO_REPLY correction: 19 run-entry tests and 11 terminal-preparation tests passed; both model-switch proof suites passed 6/6 tests. Targeted oxfmt, oxlint, and git diff --check passed.
  • Run-owned terminal-reply correction: 35 QA agent-process tests, 5 follow-up proof tests, and 3 tool-continuity proof tests passed, including regressions where an unrelated later outbound contains continuity text. Targeted oxfmt, oxlint, and git diff --check passed.
  • The default oxlint wrapper stopped before lint on the known untouched stale local signature mismatch at packages/terminal-core/src/ansi.ts:194; targeted lint then passed with the wrapper's OPENCLAW_OXLINT_SKIP_PREPARE=1 path. No dependency reconciliation was performed.
  • Targeted formatting, git diff --check, producer audit, and syntax/style lint passed.
  • Run-owned terminal-delivery correction 89598fab1bf4f6eba61305887d52bb89073e5c11: 203 focused tests passed across lifecycle, strict delivery failure propagation, gateway wait projection, QA wait preservation, Crabline restoration, and both model-switch proof suites. Targeted formatting, oxlint, max-lines, and git diff --check passed; Sol high autoreview was clean at 0.98.
  • Primary-run delivery binding correction 720a252555fac8aa4dfc710be28d1de23e2d7df0: both model-switch proof suites passed 19/19 focused tests, including missing, suppressed, and zero-count primary delivery with identical and unrelated bus messages. Targeted formatting, oxlint, max-lines, and git diff --check passed; Sol high autoreview was clean at 0.99.
  • Independent exact-head review of 720a252555fac8aa4dfc710be28d1de23e2d7df0 was clean.
  • The Crabline transport source and test were restored exactly to df9c30fe7e6cf54fc09b4f8fb8d08717e8cc763f; Telegram visible-text projection is not part of this PR.
  • Targeted remote Codex lint: Crabbox run_2b83302392a4, exit 0, 0 warnings/errors.
  • Prior repaired head changed gate plus OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build: Crabbox run_ff4540f35d60, exit 0.
  • Prior published head fb23c3d7cc3572a3685d8398f32ddae14076f549 changed gate, full lint/import-cycle checks, and OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build: Crabbox run_4645d5ddd1a4, exit 0.
  • Head 71831a46b755bb020712606766187293aa7d2cde: Crabbox run_8722b1431469 exited 2 before tests because --fresh-pr bypassed workspace sync and omitted .openclaw-crabbox-changed-gate.bundle.
  • The corrected normal-sync AWS run run_a6a9212514f8 became obsolete when independent review invalidated that head; its exact task-owned lease cbx_1c9495799c89 was released and it is not proof for this PR head.
  • Prior head 21cf1af5e1e2648105b34c6a6881d449c07801c1: the single authorized exact-head Testbox attempt stopped before dispatch because the local Blacksmith CLI requires blacksmith auth login. No remote run ID, changed-gate result, or build result exists, and no retry was started.
  • The changed gate omitted only the known main-wide dead-export baseline in untouched src/config/**, diagnosed separately in run_73884564e548; all remaining changed lanes passed.

Punchcard

  • Punchcard-Session: golden-valley-workshop-br
  • 6a629ce048f5b219611bf71b68010b4de92f70a2: att_01KZE7ZBZKJ1PE9H6QR2CRMW8B
  • 8933cd9bd2a4506e321f52c706fb25f3d0d5f835: att_01KZE7ZCCAGJAKSC63RX6KZ5QT
  • f630f9411ed0ee57b5342e410c398255e2173154: att_01KZE7ZCXDQ39YHPSVNV506HM2
  • fb23c3d7cc3572a3685d8398f32ddae14076f549: att_01KZEBYY7QQQ170RK2RR07F063
  • 71831a46b755bb020712606766187293aa7d2cde: att_01KZEE74EH7NV86M3EREYX0B7R
  • Prior PR head 71831a46b755bb020712606766187293aa7d2cde: att_01KZEE77MQMRV4163ZRCPQTE68
  • 21cf1af5e1e2648105b34c6a6881d449c07801c1: att_01KZEFPXC3RB5S340YWDXN1PCH
  • Prior PR head 21cf1af5e1e2648105b34c6a6881d449c07801c1: att_01KZEFPXR0PBRKRW7H921N13K0
  • df9c30fe7e6cf54fc09b4f8fb8d08717e8cc763f: att_01KZEJ8P6JVCZZFND3PVK5Y6YP
  • Prior PR head df9c30fe7e6cf54fc09b4f8fb8d08717e8cc763f: att_01KZEJ8WJ9XDSX89TV5C24VX6F
  • 9b81dae7d4d501ce0cb71a51b5b118d787214630: att_01KZEMEXT2SZPVJ373Y79SE8NR
  • Prior PR head 9b81dae7d4d501ce0cb71a51b5b118d787214630: att_01KZEMEY5235M1CWCSFSX7A5HN
  • 89598fab1bf4f6eba61305887d52bb89073e5c11: att_01KZEQ0B7KDSQB4QSPV1ZE7300
  • 720a252555fac8aa4dfc710be28d1de23e2d7df0: att_01KZEQMCQHH9F4Q6Q1WPGSQJMT
  • Current PR head 720a252555fac8aa4dfc710be28d1de23e2d7df0: att_01KZEQT5BP9CERGCGK8WQHGT0B

Prior PR receipt for df9c30fe7e6cf54fc09b4f8fb8d08717e8cc763f:

pc1.cHVuY2hjYXJkLXNlcnZlci1yZWNlaXB0LXYxAGF0dF8wMUtaRUo4V0o5WERTWDg5VFY1QzI0Vlg2RgB0bnRfMDFKMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAdXNyXzAxSjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxAGRldl9FMDNCQTNBOENDNzdGOUQ5QjFCRTI3RTE5MgB3cmtfMDFLWkFCN1pDVzBHRktKTVI5QTdKRjA2MlQAc2VzXzAxS1pETTlQMDdINzVBOTlWSENSN1pOUzg0AGdvbGRlbi12YWxsZXktd29ya3Nob3AtYnIAb3BlbmNsYXcvb3BlbmNsYXcAADExOTY2MgA5Y2EyNjE3MTY3N2RjNWE1N2MwY2RmYjcwZjIxNDMzZGVmMjg3OWM0MzkzNjE3NWNkYzhlNTA2ZmY5NjJlOGYxAHNpZ25pbmctdjEAenpGQm9ZOVlBQWZHVzBQNXFMTmR3RmpoUDZ2dnhZTWJ2Z1c5U1ZiTFJ2djUzai1oQkVRTzBPUmpfSTJGZndNaXhFaVlwZ2FFNWRTMEwxRkhRUEU3Q0EAMjAyNi0wOC0wN1QxNjo1MzowMS4xMjlaAA.2qF4Wjt12TQxl-h1PnAUVkDlmtcKC4Y7fekptQjqRUVbapQ4g3FrJ8z9tNlmFMZDwGlrxMiJBiactMxEjdCNAA

Preserved prior PR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VlBQWZHVzBQNXFMTmR3RmpoUDZ2dnhZTWJ2Z1c5U1ZiTFJ2djUzai1oQkVRTzBPUmpfSTJGZndNaXhFaVlwZ2FFNWRTMEwxRkhRUEU3Q0EAMjAyNi0wOC0wN1QxNzozMToxNi41MTRaAA.APt1UE98tF0tTb_aZ6nU_cJaKSEv490X07cMR6v_WObmCHa9GEopWjkFH8S8YtZ9dY0zHlHCaBYN8IGpJfB9CQ

Current PR receipt for 720a252555fac8aa4dfc710be28d1de23e2d7df0:

pc1.cHVuY2hjYXJkLXNlcnZlci1yZWNlaXB0LXYxAGF0dF8wMUtaRVFUNUJQOUNFUkdDR0s4V1FIR1QwQgB0bnRfMDFKMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAdXNyXzAxSjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxAGRldl9FMDNCQTNBOENDNzdGOUQ5QjFCRTI3RTE5MgB3cmtfMDFLWkFCN1pDVzBHRktKTVI5QTdKRjA2MlQAc2VzXzAxS1pETTlQMDdINzVBOTlWSENSN1pOUzg0AGdvbGRlbi12YWxsZXktd29ya3Nob3AtYnIAb3BlbmNsYXcvb3BlbmNsYXcAADExOTY2MgA5Y2EyNjE3MTY3N2RjNWE1N2MwY2RmYjcwZjIxNDMzZGVmMjg3OWM0MzkzNjE3NWNkYzhlNTA2ZmY5NjJlOGYxAHNpZ25pbmctdjEAenpGQm9ZOVlBQWZHVzBQNXFMTmR3RmpoUDZ2dnhZTWJ2Z1c5U1ZiTFJ2djUzai1oQkVRTzBPUmpfSTJGZndNaXhFaVlwZ2FFNWRTMEwxRkhRUEU3Q0EAMjAyNi0wOC0wN1QxODoyOTo1MC4wNzBaAA.4Lc0SjTrxbDH7EPu6ytk1lROJ8ChWzkS2RH5kNpVZN_TeNp9fVTiSaNfxSwlwh4LitWZCmKLojHiP1EauBUKAw

Remaining Gates

The PR remains open. Remaining gates are hosted exact-head CI, exact-head ClawSweeper review, remote changed-gate/private-QA build proof, and repo-native maintainer landing.

@steipete
steipete marked this pull request as ready for review August 5, 2026 15:00
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 2:39 PM ET / 18:39 UTC.

ClawSweeper review

What this changes

The PR makes model-switch QA require run-owned terminal receipts, completed tool evidence, visible replies, and successful delivery for both the primary and alternate runs.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this PR open for maintainer review: the rendered exact-head diff appears to address the prior alias finding, but the required direct Codex protocol inspection and exact-head source audit could not be completed because ../codex is absent and network DNS is unavailable. Likely related people: vincentkoc (high) and steipete (high).

Priority: P2
Reviewed head: 720a252555fac8aa4dfc710be28d1de23e2d7df0
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has substantial focused regression coverage in the supplied PR context, but the unavailable exact-head and Codex-contract inspection prevent a stronger rating.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository state identifies the author as a member, so the external-contributor proof gate does not apply; this review still cannot certify the exact head while dependency inspection is unavailable.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies the author as a member, so the external-contributor proof gate does not apply; this review still cannot certify the exact head while dependency inspection is unavailable.
Evidence reviewed 7 items Clean current-main checkout: The checkout is clean on current main c25671cf275a4b5a339db182a5ba8bffc2e73c11; it is not checked out at the PR head.
PR-head provenance: The local commit object identifies the reviewed PR head as Vincent Koc's fix(qa): bind primary model-switch delivery, with parent 89598fab1bf4f6eba61305887d52bb89073e5c11.
Prior finding addressed in rendered diff: The supplied exact-head patches add normalizeModelRef to QA runtime dependencies and alias-backed scenario regressions, matching the prior request to dispatch the canonical alternate model reference.
Findings None None.
Security None None.

How this fits together

QA Lab runs model-switch scenarios through the agent and gateway lifecycle, then evaluates the terminal facts returned for each run. Provider adapters supply effective-model and tool outcomes; the lifecycle and gateway return bounded receipt, reply, and delivery evidence to the QA scenario.

flowchart LR
  A[QA model-switch scenario] --> B[Agent run]
  B --> C[Provider adapter]
  C --> D[Terminal receipt and reply]
  D --> E[Delivery result]
  D --> F[Gateway wait result]
  E --> F
  F --> G[QA evidence evaluation]
Loading

Decision needed

Question Recommendation
Should this maintainer-owned PR wait for a re-review environment with the required sibling Codex source, or should a maintainer explicitly perform and record that protocol-contract review before merge? Restore contract evidence and re-review: Provision the matching sibling Codex checkout, inspect the protocol at the PR head, and request one exact-head re-review after pending checks complete.

Why: Repository policy prohibits a Codex-backed correctness or proof-sufficient verdict without direct inspection of ../codex; the read-only environment cannot clone it because DNS is unavailable.

Before merge

  • Resolve merge risk (P1) - The exact PR source blobs and required sibling Codex contract could not be inspected locally, so a merge or proof-sufficient verdict would violate the repository's Codex dependency gate.
  • Resolve merge risk (P1) - The PR changes QA automation semantics and is behind main while required checks remain in progress; refresh exact-head review after the evidence gate is restored.
  • Complete next step (P2) - The next action is to restore the mandatory dependency-contract evidence and complete the exact-head review, not to dispatch a mechanical repair.
Agent review details

Security

None.

PR surface

Source +194, Tests +817, Other +1. Total +1012 across 43 files.

View PR surface stats
Area Files Added Removed Net
Source 22 216 22 +194
Tests 19 833 16 +817
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 75 74 +1
Total 43 1124 112 +1012

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: src/agents/agent-command.live-model-switch.test.ts, serialized state: src/agents/command/lifecycle.test.ts, serialized state: src/gateway/server-methods/agent-wait-dedupe.test.ts, vector/embedding metadata: extensions/codex/src/app-server/event-projector.native-finalization.test.ts, vector/embedding metadata: src/agents/command/lifecycle.ts, vector/embedding metadata: src/agents/command/post-run.ts, and 1 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Re-establish exact-head contract proof (recommended)
    Before merge, make the sibling Codex source available, verify the model/rerouted ownership contract directly, and refresh review after current checks finish.
  2. Pause pending maintainer evidence
    Keep the PR open until a maintainer can supply or independently record the missing dependency-contract review.

Technical review

Best possible solution:

Restore the sibling Codex checkout or otherwise provide the required direct protocol source, then rerun an exact-head review and wait for the remaining QA and compact-check lanes before deciding whether to merge.

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

No high-confidence live reproduction was established in this read-only audit; the rendered PR tests simulate the stale-reply, alias, and delivery-evidence cases, but their exact-head sources could not be executed or fully read locally.

Is this the best way to solve the issue?

Unclear: the rendered diff follows the correct producer-to-lifecycle-to-gateway ownership direction and appears to fix the prior alias issue, but direct Codex contract inspection is mandatory before confirming it is the best fix.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies the author as a member, so the external-contributor proof gate does not apply; this review still cannot certify the exact head while dependency inspection is unavailable.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This corrects QA evidence integrity rather than an active user-facing runtime failure.
  • merge-risk: 🚨 automation: Merging changes the evidence and pass/fail criteria used by model-switch QA automation.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies the author as a member, so the external-contributor proof gate does not apply; this review still cannot certify the exact head while dependency inspection is unavailable.

Evidence

What I checked:

  • Clean current-main checkout: The checkout is clean on current main c25671cf275a4b5a339db182a5ba8bffc2e73c11; it is not checked out at the PR head. (c25671cf275a)
  • PR-head provenance: The local commit object identifies the reviewed PR head as Vincent Koc's fix(qa): bind primary model-switch delivery, with parent 89598fab1bf4f6eba61305887d52bb89073e5c11. (720a252555fa)
  • Prior finding addressed in rendered diff: The supplied exact-head patches add normalizeModelRef to QA runtime dependencies and alias-backed scenario regressions, matching the prior request to dispatch the canonical alternate model reference. (extensions/qa-lab/src/suite-runtime-flow.ts:220, 720a252555fa)
  • Current owner boundary: Current main already keeps terminal assistant data scoped to the completed attempt, which is the lifecycle boundary extended by this PR's rendered receipt changes. (src/agents/embedded-agent-runner/run/terminal-preparation.ts:67, c25671cf275a)
  • History ownership: Recent current-main history attributes exact execution-identity work to Vincent Koc; QA/Codex hardening history attributes the adjacent live-QA surface to Peter Steinberger. (src/agents/embedded-agent-runner/run/terminal-preparation.ts:67, d863dd5f5ecf)
  • Required Codex contract unavailable: The required sibling ../codex checkout is absent. The partial-clone attempt to inspect PR blobs also failed because GitHub DNS could not resolve, so PR text cannot substitute for the direct dependency-contract gate.

Likely related people:

  • vincentkoc: Introduced the current-main exact execution-identity refactor and authored the PR's terminal-evidence follow-up commits. (role: recent area contributor; confidence: high; commits: d863dd5f5ecf, 720a252555fa; files: src/agents/embedded-agent-runner/run/terminal-preparation.ts, src/gateway/server-methods/agent-job.ts)
  • steipete: Feature history shows substantial authorship across the affected QA, terminal-preparation, and gateway-job surfaces; the current main's adjacent Codex/live-QA hardening is also attributed to Peter Steinberger. (role: major QA/Codex area contributor; confidence: high; commits: cb16d739cfda; files: extensions/qa-lab/src/suite-runtime-flow.ts, extensions/codex/src/app-server/event-projector.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Restore the sibling Codex checkout and obtain one exact-head review after the remaining checks complete.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-05T16:25:46.852Z sha 299aa8a :: needs changes before merge. :: [P2] Stabilize the initial transcript before saving its cursor
  • reviewed 2026-08-05T19:31:05.277Z sha d0d3273 :: needs changes before merge. :: [P2] Correlate the initial read with the current attempt
  • reviewed 2026-08-05T19:37:39.779Z sha d0d3273 :: found issues before merge. :: [P2] Correlate the initial read with the current attempt
  • reviewed 2026-08-05T20:30:40.663Z sha d0d3273 :: found issues before merge. :: [P2] Correlate the initial read with the current attempt
  • reviewed 2026-08-07T14:43:01.458Z sha f630f94 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-07T15:47:48.793Z sha 71831a4 :: found issues before merge. :: [P2] Classify silent terminal receipts as not-visible
  • reviewed 2026-08-07T16:40:36.893Z sha 21cf1af :: found issues before merge. :: [P2] Bind the continuity reply to the alternate run
  • reviewed 2026-08-07T17:42:22.878Z sha 9b81dae :: found issues before merge. :: [P2] Run the alternate model using its canonical reference

@steipete

steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 5, 2026
@steipete
steipete force-pushed the codex/autoqa-model-switch-authentic-evidence-20260805 branch from 299aa8a to d0d3273 Compare August 5, 2026 18:00
@steipete

steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Aug 5, 2026
@vincentkoc
vincentkoc force-pushed the codex/autoqa-model-switch-authentic-evidence-20260805 branch from d0d3273 to f630f94 Compare August 7, 2026 14:30
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling extensions: codex labels Aug 7, 2026
@vincentkoc vincentkoc self-assigned this Aug 7, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 7, 2026
Punchcard-Session: golden-valley-workshop-br
Punchcard-Session: golden-valley-workshop-br
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 7, 2026
Punchcard-Session: golden-valley-workshop-br
Punchcard-Session: golden-valley-workshop-br
Punchcard-Session: golden-valley-workshop-br
Punchcard-Session: golden-valley-workshop-br
Punchcard-Session: golden-valley-workshop-br
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 7, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer evidence for exact head 720a252555fac8aa4dfc710be28d1de23e2d7df0:

  • Direct dependency inspection was completed against latest upstream openai/codex origin/main at 27e4a05cd34f069ce043770b8e79969c992e87d4.
  • codex-rs/core/src/session/mod.rs:3196-3231 emits EventMsg::ModelReroute on the active TurnContext before the warning.
  • codex-rs/app-server/src/bespoke_event_handling.rs:352-362 maps it to the awaited model/rerouted notification, carrying thread_id and event_turn_id.
  • codex-rs/app-server/tests/suite/v2/safety_check_downgrade.rs:344-379 requires model/rerouted before turn/completed.
  • This supports the PR's turn/run-owned receipt boundary rather than indirect message-history inference.
  • Exact-head hosted CI run 31207205045 completed successfully: 57 successful jobs, 13 skipped, zero failed.
  • Isolated direct AWS Crabbox proof run_82313067d23e passed the exact-head frozen install, check:changed, and OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build with exit 0; its task-owned lease was released.

The ClawSweeper rank-up evidence gap is now closed.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@vincentkoc
vincentkoc merged commit 5a795f4 into main Aug 7, 2026
130 checks passed
@vincentkoc
vincentkoc deleted the codex/autoqa-model-switch-authentic-evidence-20260805 branch August 7, 2026 19:05
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 8, 2026
…ls (openclaw#119662)

* fix(qa): require a fresh reply after switching models

* fix(qa): prove successful tool use after model switching

* fix(qa): wait for the new persisted model-switch tool result

* fix(qa): authenticate canonical model-switch attempt evidence

* fix(ai): preserve effective response model evidence

Punchcard-Session: golden-valley-workshop-br

* fix(agent): publish run-owned terminal receipts

Punchcard-Session: golden-valley-workshop-br

* fix(qa): require run-owned model-switch evidence

Punchcard-Session: golden-valley-workshop-br

* fix(agent): record explicit tool completion outcomes

Punchcard-Session: golden-valley-workshop-br

* fix(agent): exclude unavailable approvals from receipts

Punchcard-Session: golden-valley-workshop-br

* fix(agent): derive receipt visibility from terminal reply

Punchcard-Session: golden-valley-workshop-br

* fix(qa): bind model-switch continuity to terminal reply

Punchcard-Session: golden-valley-workshop-br

* fix(qa): project Crabline Telegram visible text

Punchcard-Session: golden-valley-workshop-br

* fix(qa): record run-owned delivery evidence

Punchcard-Session: golden-valley-workshop-br

* fix(qa): bind primary model-switch delivery

Punchcard-Session: golden-valley-workshop-br

---------

Co-authored-by: Vincent Koc <[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 extensions: codex extensions: copilot extensions: qa-lab gateway Gateway runtime 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants