Skip to content

refactor: simplify Gateway session lifecycle test gates - #142833

Merged
steipete merged 1 commit into
mainfrom
codex/test-sessions-deferred-53
Sep 9, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-sessions-deferred-53

Conversation

@steipete

@steipete steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Related: #139428

What Problem This Solves

Gateway session lifecycle tests repeat manual Promise resolver setup. The rollback case also waits until its 120-second timeout when creation fails before rollback begins, hiding an actionable allocation error.

Why This Change Was Made

Reuse the existing deferred helper for 20 eager gates while preserving allocation points, resolver calls, optional guards and lifecycle assertions. Keep lazy and outer-finally gates unchanged. Race rollback startup against actual request completion so an early failure reports its result. This removes 50 net test lines, including two consequent formatter joins; no cases or production code are removed.

User Impact

No product behavior changes. Maintainers get smaller lifecycle fixtures and a useful failure message when the rollback setup cannot complete.

Evidence

  • Healthy Linux baseline and candidate: 237 passed, 0 skipped across the same six complete suites, with identical ordered case identities.
  • A low-disk diagnostic exposed the actual UNAVAILABLE allocation result in 533ms instead of the original 120-second barrier timeout. Capacity checks and deadlines remain unchanged.
  • Final lint removed 20 redundant default type arguments; emitted JavaScript is byte-identical to the Linux-tested candidate in each file.
  • Mapped changed gate passed; fresh P2 review found no actionable issues.

The original Mac baseline's disk-capacity failures are retained in the audit evidence; the healthy Linux run supplies the complete suite proof. No runtime speedup is claimed.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 9, 2026
@steipete
steipete marked this pull request as ready for review September 9, 2026 04:39
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Sep 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 12:45 AM ET / 04:45 UTC.

ClawSweeper review

What this changes

The PR replaces manual promise gates in Gateway session tests with the existing deferred helper and reports creation failures that occur before rollback starts.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful, maintainer-requested cleanup, and no introduced correctness defect was found. Current main retains the rollback wait that this PR improves.

Priority: P3
Reviewed head: faa3142c27737ef2e76d3d03eccd3ae3c05c3615

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused cleanup using the established helper, with preserved assertions, useful reported validation, and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored test cleanup changes no production owner or runtime authority boundary; the supplied Linux suite comparison and low-disk diagnostic are relevant supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored test cleanup changes no production owner or runtime authority boundary; the supplied Linux suite comparison and low-disk diagnostic are relevant supplemental validation.
Evidence reviewed 7 items Pinned introduction and merge scope: Raw commit records match the supplied original-head parent and test-merge parents. The verified merge result changes only the six session test files; unrelated endpoint drift is not attributed to this PR.
Existing deferred implementation: The shared helper uses Promise.withResolvers, and the test helper directly reexports it. This preserves eager promise allocation and resolver semantics on the repository's supported Node versions.
Rollback failure handling: The race observes actual request completion while preserving the rollback gate, successor serialization assertions, and finally cleanup. The request helper awaits the real session handler before returning its captured response.
Findings None None.
Security None None.

How this fits together

Gateway session handlers coordinate creation, deletion, reset, and updates to session state. These tests pause concurrent operations at controlled boundaries to verify ordering, cleanup, and ownership checks.

flowchart LR
  A[Test session requests] --> B[Gateway session handlers]
  B --> C[Lifecycle coordination]
  D[Deferred test gates] --> C
  C --> E[Session state and worktree cleanup]
  E --> F[Ordering and ownership assertions]
  B --> G[Early failure diagnostic]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -50. Total -50 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 6 31 81 -50
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 31 81 -50

Review metrics

None.

Root-cause cluster

Relationship: partial_overlap
Canonical: #139428
Summary: This PR supplies one bounded cleanup batch for the broader test-audit campaign; it does not complete the campaign's runtime or coverage targets.

Members:

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

Technical review

Best possible solution:

Retain the shared deferred gates and early rollback diagnostic while preserving the existing lifecycle scenarios, assertions, and cleanup.

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

Not applicable to a product defect: this is test-only cleanup. Source confirms the old rollback wait can hide an early request result; the supplied body reports a low-disk diagnostic, which was not rerun here.

Is this the best way to solve the issue?

Yes. Reusing the existing helper preserves gate semantics, and racing rollback startup against request completion improves diagnostics without weakening lifecycle assertions.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is test-maintenance cleanup with improved failure diagnostics and no production behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored test cleanup changes no production owner or runtime authority boundary; the supplied Linux suite comparison and low-disk diagnostic are relevant supplemental validation.

Label justifications:

  • P3: This is test-maintenance cleanup with improved failure diagnostics and no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored test cleanup changes no production owner or runtime authority boundary; the supplied Linux suite comparison and low-disk diagnostic are relevant supplemental validation.

Evidence

What I checked:

  • Pinned introduction and merge scope: Raw commit records match the supplied original-head parent and test-merge parents. The verified merge result changes only the six session test files; unrelated endpoint drift is not attributed to this PR. (d7b063991191)
  • Existing deferred implementation: The shared helper uses Promise.withResolvers, and the test helper directly reexports it. This preserves eager promise allocation and resolver semantics on the repository's supported Node versions. (src/shared/deferred.ts:13, faa3142c2773)
  • Rollback failure handling: The race observes actual request completion while preserving the rollback gate, successor serialization assertions, and finally cleanup. The request helper awaits the real session handler before returning its captured response. (src/gateway/server.sessions.create.test.ts:2124, faa3142c2773)
  • Still useful on current main: Fetched main still constructs the rollback promises manually and awaits rollbackStarted without observing early request completion. Release-file inspection could not complete because the historical blob was unavailable; no shipped-fix claim is made. (src/gateway/server.sessions.create.test.ts, 6d8281b385d0)
  • Campaign context and supplied validation: The captured PR body links the open maintainer-requested test audit at Test audit: reduce redundant test code and full-suite runtime #139428. It reports matching Linux baseline/candidate results of 237 passing cases and a low-disk diagnostic returning the allocation error in 533ms. These are author-reported results; this read-only review did not execute tests. (faa3142c2773)
  • Area history: Current-main history records Peter Steinberger's prior session deletion and lifecycle work. Exact line-introduction verification was unavailable, so this supports routing only. (src/gateway/server.sessions.delete-lifecycle.test.ts, 54af8f1b839f)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit e226535 into main Sep 9, 2026
170 checks passed
@steipete
steipete deleted the codex/test-sessions-deferred-53 branch September 9, 2026 04:50
@steipete

steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to LiuwqGit/openclaw that referenced this pull request Sep 9, 2026
…1-prep

* commit 'b04a3f83adad8bd6a2ca8408e7940fc6bcbde212': (636 commits)
  docs(cli): split the doctor command reference by reader job (openclaw#142855)
  fix(ui): explain paused weekly skill reviews (openclaw#142840)
  docs(automations): describe supported schedule options (openclaw#135964)
  fix(image): close registration resources after generation (openclaw#142843)
  fix(slack): keep ack reactions independent of status reactions (openclaw#142595)
  fix(ui): avoid flashes when switching cold sessions (openclaw#134868)
  refactor(tests): share independent no-queued-reply expectations (openclaw#142845)
  perf: reduce generated media reference formatting overhead (openclaw#142836)
  fix: sessions_yield keeps long transcript history available (openclaw#137381)
  fix(music): close registration resources after generation (openclaw#142834)
  fix: update confirmation shows stale commit counts after refresh (openclaw#142837)
  fix(ci): retain Android emulator post-timeout evidence (openclaw#142835)
  fix(talk): retain final delivery across delegation waves (openclaw#142830)
  docs(gateway): run Linux system services as the state owner (openclaw#136266)
  fix(models): align static Anthropic aliases with manifest (openclaw#137376)
  test(gateway): simplify session lifecycle gates and report early rollback failures (openclaw#142833)
  refactor(ai): keep model policy parsing independent of transport host (openclaw#142804)
  refactor: simplify interactive SDK forwarding (openclaw#142824)
  fix(cli): finish pending cleanup before automatic macOS exit (openclaw#142814)
  docs(memory-lancedb): clarify enforced compatibility ranges (openclaw#142827)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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