Skip to content

fix(qa): allow standalone utility completions after observing sessions - #158452

Merged
RomneyDa merged 2 commits into
mainfrom
fix/qa-utility-session-affinity-20260925
Sep 26, 2026
Merged

RomneyDa merged 2 commits into
mainfrom
fix/qa-utility-session-affinity-20260925

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: QA mock-provider runs reject standalone JSON and memory-dreaming completions after an agent session has been observed, even though those host-prepared utility calls intentionally carry no session affinity.

User Impact

No shipped user-facing behavior changes. QA can exercise the utility completion and dreaming flows without assigning utility calls to an unrelated conversation. Agent calls still require transport identity after session observation; quoted utility text and tool-enabled requests do not bypass that requirement.

Why This Change Was Made

Recognize the three existing tool-free system-prompt contracts at the mock session-identity owner. Do not recover conversation identity from prompt text. The registered-server regression covers accepted utility calls and rejected quoted/tool-enabled lookalikes.

This narrowly scoped fix is submitted for hosted CI and ClawSweeper review at the maintainer's explicit request after the local independent reviewer became unavailable. It is not a merge or release request.

Evidence

  • Inspected the complete affected resolver and server tests, utility prompt producers, and current main. These changes are not already on main at b74bd07a2fb073d04b1f2de3687513d495d26f11.

  • Registered mock-server boundary reproduced red before the fix; corrected suite passed 11/11. Measured wall time: 31.58 s Vitest / 36.10 s wrapper, dominated by cold transform; the five new cases took 12–19 ms each.

  • Both original memory-dreaming Gateway E2E cases passed, 68.843 s and 64.168 s. These existing real-Gateway tests cover provenance and explicit workspace-owner routing; they are not new per-PR compositions.

  • Changed-file checks completed with 0 warnings and 0 errors; git diff --check passed. Evidence was collected on base 0e56c40dcf6 with this exact patch and a separate, disjoint file-transfer test-inventory patch. This PR contains only the utility fix.

  • Independent local review unavailable: required review was attempted but returned HTTP 403 / reviewer_unavailable, with no accepted findings. Manual source inspection is not a successful independent review. Hosted review is requested; no ready-for-release claim.

  • Broader validation remains incomplete: the combined seven-file run had four failures and nineteen skipped tests. OTEL and timeout exact E2Es were blocked by the packaged-artifact publication guard; a subagent recovery case also hit a QA-channel module-loading failure. These are disclosed gaps, not passing qualification. No full release validation was dispatched by this PR task.

  • Published-head CI is attached to 3292f40b736b25b54f978546b654b84fcc702fa8: CI run 36202744736, currently in progress. CI duration and outcome are pending. ClawSweeper acknowledged the PR; independent hosted review has not completed.

Contributor credit: RomneyDa (commit co-author).

ClawSweeper finding addressed

Addressed the P2 utility-continuation finding. The sessionless exception now requires that the request contain no Responses function-call or custom-tool output items, using the existing input owner's predicate rather than a second type classification. This also excludes empty results and earlier tool history; a later user item cannot disguise session-bound state as a standalone utility completion.

Three registered-server cases failed before the guard (HTTP200 instead of the required missing-affinity rejection). The corrected session-identity and Responses-input suites pass20/20. The new cases also verify that providing valid affinity admits the same requests. All three legitimate standalone utility contracts and interleaved session isolation still pass. This is boundary proof, not an additional live Gateway/FRV replay.

Exact correction head: 3d55cd2. Full selected changed checks passed, including production/test types, lint, guards, dead exports, and runtime import-cycle checks. The two-file test command completed in 26.46 seconds wall (mostly cold worker compilation); the new HTTP cases took 7–9 ms each.

A fresh bounded local independent review again produced no verdict (reviewer_unavailable/timeout), not a clean review. This correction is submitted for hosted CI and exact-head ClawSweeper review under the current publication instruction. No merge or validation-target change.

@clawsweeper

clawsweeper Bot commented Sep 25, 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.

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 25, 2026 23:53
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 25, 2026, 8:23 PM ET / September 26, 2026, 00:23 UTC (Revision 2).

ClawSweeper review

What this changes

QA Lab’s mock provider now accepts three tool-free utility completion prompts after observing an agent session and adds HTTP regression cases for accepted and rejected requests.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this PR open. The latest correction addresses the prior tool-output finding, but the session-isolation rule still admits history-bearing requests as standalone utility calls.

Priority: P2
Reviewed head: 3d55cd2a89f7a6fa2b14095c2aa82bf3cbfbed9e

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The boundary proof and focused patch are useful, but one session-isolation case remains unguarded.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The contributor reports exercising the registered QA mock server through real HTTP requests after session observation: legitimate utility requests returned 200, missing-affinity tool-output continuations returned 500, and the focused suites passed 20/20 at the correction head. This proves the reported correction at the mock-provider boundary, while the history-bearing input in the finding remains uncovered. No stored-data contract changes.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The contributor reports exercising the registered QA mock server through real HTTP requests after session observation: legitimate utility requests returned 200, missing-affinity tool-output continuations returned 500, and the focused suites passed 20/20 at the correction head. This proves the reported correction at the mock-provider boundary, while the history-bearing input in the finding remains uncovered. No stored-data contract changes.
Evidence reviewed 9 items Current main still rejects the intended utility call: The current-main resolver rejects every request without affinity once a session has been observed; the PR’s utility exception is absent.
Introduced exception: The PR admits a matching instruction prefix when tools and tool-output items are absent, without excluding earlier assistant messages or function-call items.
Prior finding addressed: The second commit added the tool-output exclusion requested by the previous ClawSweeper review; the earlier standalone predicate otherwise remained in place.
Findings 1 actionable finding [P2] Reject history-bearing requests from the utility exception
Security None None.

How this fits together

QA Lab’s mock provider receives model requests from OpenClaw test runs. Its session resolver selects isolated scenario state before the server returns a simulated model response.

flowchart LR
  A[QA test run] --> B[Mock provider request]
  B --> C[Session observer]
  C --> D[Session identity decision]
  D --> E[Scenario state]
  E --> F[Simulated response]
Loading

Before merge

  • Reject history-bearing requests from the utility exception (P2) - Late discovery: the earlier reviewed predicate had this gap too. After session observation, a matching instruction prefix with tools: [] and an earlier assistant or function_call item passes this guard because neither is a tool output. The resolver returns no identity, and the server selects shared anonymous scenario state instead of rejecting missing affinity. Restrict the exception to a history-free utility turn and cover this request at the registered-server boundary.
  • Resolve merge risk (P1) - A history-bearing request with a utility instruction prefix and no declared tools can enter shared anonymous QA scenario state after session observation.
  • Complete next step (P2) - Constrain the sessionless exception to history-free utility inputs and add a registered-server rejection case before merge.

Findings

  • [P2] Reject history-bearing requests from the utility exception — extensions/qa-lab/src/providers/mock-openai/session-identity.ts:50-57
Agent review details

Security

None.

PR surface

Source +21, Tests +61. Total +82 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 24 3 +21
Tests 1 61 0 +61
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 85 3 +82

Review metrics

Metric Value Why it matters
Production and test growth production +21 lines; tests +61 lines The production growth is confined to QA session classification, with boundary cases protecting the new behavior.
Focused check cost 20/20 checks; 26.46 s reported wall time The contributor measured the two relevant suites; most reported time was cold worker compilation.

Merge-risk options

Maintainer options:

  1. Constrain the utility exception (recommended)
    Reject assistant history and function or custom tool-call items without affinity, then cover those requests at the registered HTTP boundary.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Keep the three legitimate standalone utility prompts working, but require transport affinity whenever Responses input contains prior assistant history or function/custom tool-call items; add registered-server rejection and admitted-affinity cases.

Technical review

Best possible solution:

Accept the existing utility prompts only for history-free, tool-free completion inputs; require affinity for every conversation continuation.

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

Yes, from source: observe a session, then send a Responses request with a utility instruction prefix, tools: [], and an earlier assistant or function-call item but no affinity. This read-only review did not execute that request.

Is this the best way to solve the issue?

No, as written. The exception should also establish that the input is a standalone utility turn before selecting anonymous state.

Full review comments:

  • [P2] Reject history-bearing requests from the utility exception — extensions/qa-lab/src/providers/mock-openai/session-identity.ts:50-57
    Late discovery: the earlier reviewed predicate had this gap too. After session observation, a matching instruction prefix with tools: [] and an earlier assistant or function_call item passes this guard because neither is a tool output. The resolver returns no identity, and the server selects shared anonymous scenario state instead of rejecting missing affinity. Restrict the exception to a history-free utility turn and cover this request at the registered-server boundary.
    Confidence: 0.91
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The contributor reports exercising the registered QA mock server through real HTTP requests after session observation: legitimate utility requests returned 200, missing-affinity tool-output continuations returned 500, and the focused suites passed 20/20 at the correction head. This proves the reported correction at the mock-provider boundary, while the history-bearing input in the finding remains uncovered. No stored-data contract changes.

Label justifications:

  • P2: This is a bounded QA reliability defect with no shipped user-facing change.
  • merge-risk: 🚨 session-state: The introduced exception can assign a conversation continuation to shared anonymous scenario state.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The contributor reports exercising the registered QA mock server through real HTTP requests after session observation: legitimate utility requests returned 200, missing-affinity tool-output continuations returned 500, and the focused suites passed 20/20 at the correction head. This proves the reported correction at the mock-provider boundary, while the history-bearing input in the finding remains uncovered. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The contributor reports exercising the registered QA mock server through real HTTP requests after session observation: legitimate utility requests returned 200, missing-affinity tool-output continuations returned 500, and the focused suites passed 20/20 at the correction head. This proves the reported correction at the mock-provider boundary, while the history-bearing input in the finding remains uncovered. No stored-data contract changes.

Evidence

Acceptance criteria:

  • [P1] pnpm test extensions/qa-lab/src/providers/mock-openai/server.session-identity.test.ts --maxWorkers=1.
  • [P1] pnpm test extensions/qa-lab/src/providers/mock-openai/mock-openai-input.test.ts --maxWorkers=1.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • joshavant: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Add a registered-server case with earlier assistant or function-call history and constrain the exception so it rejects before scenario-state selection.

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 (1 earlier review cycle)
  • reviewed 2026-09-26T00:01:27.938Z sha 3292f40 :: blocked before merge. :: [P2] Reject tool-output continuations in the utility exception

Keep the standalone utility exception free of function and custom tool outputs, including empty or earlier-history results. Reuse the canonical input predicate and cover missing versus admitted affinity at the registered HTTP boundary.

Co-authored-by: RomneyDa <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Addressed the P2 utility-continuation finding. The sessionless exception now requires that the request contain no Responses function-call or custom-tool output items, using the existing input owner's predicate rather than a second type classification. This also excludes empty results and earlier tool history; a later user item cannot disguise session-bound state as a standalone utility completion.

Three registered-server cases failed before the guard (HTTP200 instead of the required missing-affinity rejection). The corrected session-identity and Responses-input suites pass20/20. The new cases also verify that providing valid affinity admits the same requests. All three legitimate standalone utility contracts and interleaved session isolation still pass. This is boundary proof, not an additional live Gateway/FRV replay.

Exact correction head: 3d55cd2. Full selected changed checks passed, including production/test types, lint, guards, dead exports, and runtime import-cycle checks. The two-file test command completed in 26.46 seconds wall (mostly cold worker compilation); the new HTTP cases took 7–9 ms each.

A fresh bounded local independent review again produced no verdict (reviewer_unavailable/timeout), not a clean review. This correction is submitted for hosted CI and exact-head ClawSweeper review under the current publication instruction. No merge or validation-target change.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 26, 2026
@RomneyDa
RomneyDa enabled auto-merge (squash) September 26, 2026 00:25
@RomneyDa
RomneyDa merged commit 31a5754 into main Sep 26, 2026
105 of 107 checks passed
@RomneyDa
RomneyDa deleted the fix/qa-utility-session-affinity-20260925 branch September 26, 2026 00:30
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

The remaining history-isolation finding is addressed in #158496. #158452 merged before that correction was published, so the follow-up contains only the additional repair on current main; the deleted branch was not recreated. Exact follow-up tests pass 35/35; hosted CI and review are pending.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
openclaw#158452)

* fix(qa): accept standalone utility completions after session observation

Co-authored-by: RomneyDa <[email protected]>

* fix(qa): reject sessionless tool-result continuations

Keep the standalone utility exception free of function and custom tool outputs, including empty or earlier-history results. Reuse the canonical input predicate and cover missing versus admitted affinity at the registered HTTP boundary.

Co-authored-by: RomneyDa <[email protected]>

---------

Co-authored-by: roboclaw-bot <[email protected]>
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

extensions: qa-lab merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants