Skip to content

test(gateway): expect requester history when a policy outage refuses a child wake - #204602

Merged
obviyus merged 2 commits into
mainfrom
fix/e2e-yield-policy-history
Nov 24, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/e2e-yield-policy-history

Conversation

@obviyus

@obviyus obviyus commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Problem

test/gateway-yield-restart.e2e.test.ts ("preserves yielded work through an actual Gateway restart (policy-unavailable)") fails on main: expected '[{"role":"user",…' to contain 'REQUESTER_RECEIVED_CHILD_COMPLETION'. No scheduled CI lane runs this file.

The case injects one transient access-policy outage while the child's completion wakes its yielded requester. It then waits for a second, retried wake turn. #204178 removed that retry. When a wake does not consume the child's result, the child's end state is appended once to the requester transcript as model-visible history (a hidden subagent-completion entry), and the delivery settles.

A debug run on main shows exactly that: Subagent completion direct announce failed … Gateway access policy is unavailable, then Subagent status appended to requester history.

Solution

Test-only change. For policy-unavailable, the test now asserts the #204178 contract: exactly one hidden subagent-completion entry in the requester transcript, naming the child session with status completed and the child's result (PARKED_CHILD_COMPLETED). The other cases are unchanged. The existing checks still apply: the outage was injected, and restart recovery did not refuse the input.

Impact

No change to production code or user behavior.

Evidence

  • Before: policy-unavailable fails on main (27dc1533) with the error above; a debug run shows the history append.
  • After: policy-unavailable passes on a built Gateway with this change.
  • Not covered by this PR: in the same full-file run, 4 other cases (completed-before, continue, root-main-legacy-stopped, root-main-tool-stopped) failed with SyntaxError: Unexpected end of JSON input at test/gateway-restart.test-support.ts:95 (the fake provider parses an empty request body). This change does not touch those cases or that fixture. They pass on main in other runs; the empty-body cause is tracked separately.

…a child wake

Since #204178 a wake that does not consume a child's result appends the child's end state
to requester history once, with no retried wake turn. The policy-unavailable case still
waited for the retried turn.

Co-authored-by: obviyus <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 24, 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.

@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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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 24, 2026
@clawsweeper

clawsweeper Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Updates the policy-outage restart test to expect one hidden child-completion entry in requester history.

Example: A child returns PARKED_CHILD_COMPLETED after restart, but an access-policy outage refuses its requester wake.

  • Before: The test waits for REQUESTER_RECEIVED_CHILD_COMPLETION from a retried requester turn.
  • After: The test checks for one hidden subagent-completion entry containing the child's completed status and result.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused and source-consistent test repair, supported by a reported targeted pass rather than independently inspected execution output.
Proof confidence 🦐 gold shrimp (3/6) This PR changes only test expectations; its reported built-Gateway run supports the affected scenario, and the earlier PR's screenshots do not independently prove this outage case.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: The restart regression test reports failure despite the intended child-result delivery succeeding through requester history.
Reason: Restores useful restart coverage for an explicitly accepted contract without changing user behavior.

Merge readiness

✅ Ready for maintainer review

This PR repairs an obsolete test expectation to match the merged completion-delivery contract; no actionable introduced defect was found.

Priority: P3
Reviewed head: 9b93c58602c5e395ecbf1b5e8d3b6626191c83cf

Before merge

None.

Findings

None.

Agent review details

How this fits together

The restart test drives a Gateway with a synthetic provider, interrupts yielded work, and observes recovery through Gateway responses and persisted transcripts.

flowchart TD
  A[Restart test] --> B[Gateway subprocess]
  B --> C[Synthetic provider]
  C --> D[Child completion]
  D --> E[Requester wake admission]
  E --> F[Hidden requester history]
  F --> G[Read-only transcript assertion]
Loading

Technical review

Best possible solution:

Keep the existing restart fixture and assert the completion owner's hidden-history outcome only for the refused-wake case.

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

Current source establishes the mismatch between the obsolete requester-turn assertion and history settlement; the PR reports failure before and a passing built-Gateway case afterward, without this review rerunning either.

Is this the best way to solve the issue?

The change preserves the actual restart and outage injection while observing the existing transcript owner, without adding production seams or weakening sibling scenarios.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Requester completion expectation after restart changes intended behavior with a stated reason (9464adb: The original restart test proved that preserved child work could continue and deliver completion to its requester; the later merged history-settlement contract intentionally removed the retry this case expected.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Tests +38. Total +38 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 49 11 +38
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 49 11 +38

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.

Labels

Label changes:

  • add P3: This is a focused test-expectation repair with no production behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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:

  • P3: This is a focused test-expectation repair with no production behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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 24, 2026, 6:14 AM ET / 11:14 UTC.

@obviyus
obviyus merged commit b59c1b2 into main Nov 24, 2026
86 checks passed
@obviyus
obviyus deleted the fix/e2e-yield-policy-history branch November 24, 2026 11:18
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…a child wake (openclaw#204602)

## Problem

`test/gateway-yield-restart.e2e.test.ts` ("preserves yielded work through an actual Gateway restart (policy-unavailable)") fails on `main`: `expected '[{"role":"user",…' to contain 'REQUESTER_RECEIVED_CHILD_COMPLETION'`. No scheduled CI lane runs this file.

The case injects one transient access-policy outage while the child's completion wakes its yielded requester. It then waits for a second, retried wake turn. openclaw#204178 removed that retry. When a wake does not consume the child's result, the child's end state is appended once to the requester transcript as model-visible history (a hidden `subagent-completion` entry), and the delivery settles.

A debug run on `main` shows exactly that: `Subagent completion direct announce failed … Gateway access policy is unavailable`, then `Subagent status appended to requester history`.

## Solution

Test-only change. For `policy-unavailable`, the test now asserts the openclaw#204178 contract: exactly one hidden `subagent-completion` entry in the requester transcript, naming the child session with status `completed` and the child's result (`PARKED_CHILD_COMPLETED`). The other cases are unchanged. The existing checks still apply: the outage was injected, and restart recovery did not refuse the input.

## Impact

No change to production code or user behavior.

## Evidence

- Before: `policy-unavailable` fails on `main` (`3f8dcfb5`) with the error above; a debug run shows the history append.
- After: `policy-unavailable` passes on a built Gateway with this change.
- Not covered by this PR: in the same full-file run, 4 other cases (`completed-before`, `continue`, `root-main-legacy-stopped`, `root-main-tool-stopped`) failed with `SyntaxError: Unexpected end of JSON input` at `test/gateway-restart.test-support.ts:95` (the fake provider parses an empty request body). This change does not touch those cases or that fixture. They pass on `main` in other runs; the empty-body cause is tracked separately.

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

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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.

1 participant