Skip to content

test(gateway): prove inbound writer ordering without speed race - #166820

Closed
RomneyDa wants to merge 1 commit into
mainfrom
fix/frv-session-independence-20261007
Closed

RomneyDa wants to merge 1 commit into
mainfrom
fix/frv-session-independence-20261007

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 7, 2026

Copy link
Copy Markdown
Member

Problem

The inbound worktree concurrency fixture failed beta FRV https://github.com/openclaw/openclaw/actions/runs/37694779482/job/113044095960 because a peer session write exceeded vi.waitFor's implicit one-second deadline. The contract is that the peer completes while allocation remains blocked, not that a loaded runner completes it within a second.

Change

Await the real sessions.patch request through the existing withinTest lifetime guard before releasing the held allocation lease. Use Vitest's context-bearing test.for. Remove the boolean polling projection. Keep the blocked admission, active lifecycle fence, archived row, missing checkout, peer label, restored draft, and transcript preservation assertions. finally still releases and joins owned work if the test aborts. No production lock, timeout, worker policy, or assertion is relaxed.

Proof

  • Original FRV and a local original-fixture run fail the one-second poll. An instrumented original run also showed the same peer can complete with allocation held; a passing replay alone was not treated as a fix.
  • Repaired real boundary: both already-restored values pass in original order. pnpm test src/gateway/server.sessions.inbound-worktree-writer.test.ts --maxWorkers=1: 2 passed, 85.77 s wrapper, 80.68 s Vitest (existing real worktree/Gateway setup). No new process boot or timer is added. Hosted CI seconds pending.
  • Changed-file gates pass formatting, ratchets, guards, and gateway-server test types. The dead-export gate reports inherited scripts/publish-model-catalog.mts:readRecommendedModels, unchanged from main. Focused lint is run separately; no exclusion or baseline change is added.
  • The unchanged-candidate retry remains separately recorded; this fixture repair does not claim that retry passed or that a runtime defect was repaired.

Backports

The same polling fixture and withinTest helper exist on release/2026.10.2, release/2026.10.1 (b882e76384748485669517a8b28a866acabbf718), and release/2026.9.9 (76cfa7f7734ce80e4d9046651c04c6a60e5f4002). The main patch also contains a previously migrated method spy; older branches need only the await/context delta, preserving their existing spy. Older applicability is source assessment, not executed older-line qualification.

@clawsweeper

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

@RomneyDa

RomneyDa commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review: both real inbound worktree variants pass with peer writes completed before allocation release. All original state/order assertions remain, and timeout/cancellation still unwinds through the existing withinTest cleanup guard. Focused gateway test types and lint passed; inherited dead-export failure is documented.

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Oct 7, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 7, 2026, 8:57 PM ET / October 8, 2026, 00:57 UTC (Revision 2).

ClawSweeper review

What this changes

The Gateway concurrency test awaits an unrelated session update before releasing worktree allocation, using the existing test-lifetime cancellation guard instead of one-second polling.

Product

Kind: Test only · Worth it: Yes
Reason: The release-validation fixture imposes an incidental speed deadline on a meaningful concurrency contract. Removing that deadline preserves the original intent without changing production behavior.

Merge readiness

⛔ Blocked before merge - 2 items remain

This PR remains useful: current main retains the timing-sensitive assertion, and no introduced code defect was found. The recorded validation does not yet establish the repository’s required flake qualification, a gap the earlier review overlooked.

Priority: P2
Reviewed head: ec0f09b416baaf95b394b17fea6e31deef1ce07a

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch preserves the contract, but reported harness validation does not yet meet the repository’s flake-qualification bar.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The member-authored test-only PR is outside the external-contributor runtime-proof gate. Reported validation exercises production session handlers and real worktree operations in process; repository flake qualification remains a separate validation gap. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Before merge

  • Resolve merge risk (P1) - The required repeated standalone, original-shard, and sibling qualification is not established by the recorded two-case pass.
  • Complete next step (P2) - Document the repository-required 20 clean standalone file runs, three clean original-shard runs, owner sibling coverage, and available CI seconds before merge.

Findings

None.

Tests

  • Missing end-to-end proof: The reported real-handler and worktree run is relevant boundary validation, but the required repeated file, original-shard, and owner sibling qualification is not recorded.
Agent review details

How this fits together

Inbound messages can restore an archived conversation’s working directory before reply dispatch. This test checks that waiting for restoration capacity leaves unrelated conversation updates free to finish.

flowchart TD
 A[Archived conversation resumes] --> B[Prepare working directory]
 B --> C[Allocation held by test]
 D[Unrelated conversation update] --> E[Await update completion]
 E --> F[Release allocation]
 C --> F
 F --> G[Verify restored files and transcript]
Loading

Technical review

Best possible solution:

Preserve the completion-before-allocation-release contract through the shared cancellation guard and satisfy the existing fixture qualification requirements.

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

Yes: the original fixture and reported loaded-runner failure identify the independent one-second polling deadline. Source confirms that mechanism; no failing run was executed during this review.

Is this the best way to solve the issue?

Yes: awaiting the existing request removes the incidental speed requirement while retaining allocation-held ordering, failure propagation, and cleanup.

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Preserve the completion-before-allocation-release contract through the shared cancellation guard and satisfy the existing fixture qualification requirements.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Provenance checked

Testing

Proof path: in-process harness. Added test files: 1.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5a17ad0 adds src/gateway/server.sessions.inbound-worktree-writer.test.ts:111 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5a17ad0e0e29; files: src/gateway/server.sessions.inbound-worktree-writer.test.ts)

PR surface

Tests -5. Total -5 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 7 12 -5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 7 12 -5

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This bounded test-reliability repair protects an established session concurrency contract after an observed release-validation failure.
  • 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.

Rank-up moves

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

  • Record the required standalone, original-shard, and sibling qualification results, plus available CI seconds.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-07T23:47:20.856Z sha ec0f09b :: needs maintainer review before merge. :: none

@RomneyDa

Copy link
Copy Markdown
Member Author

Closing as superseded by the current-main inbound writer test repair. The test now awaits the actual independent session RPC through withinTest(independent, signal) while allocation remains held, then releases allocation in finally. This preserves the requested ordering invariant without the old one-second polling race.

Canonical change: 2f6273f

@RomneyDa RomneyDa closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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