Skip to content

fix(ci): repair Gateway lint and Doctor mock cleanup - #158074

Merged
vincentkoc merged 3 commits into
mainfrom
fix-gateway-lint-owner-caps-20260925
Sep 25, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
fix-gateway-lint-owner-caps-20260925

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes two Gateway lint-cap failures and ensures the Doctor pending-read fixture restores its child-process observer even when preflight rejects.

User Impact

No user-visible behavior, configuration, schema, or startup API changes. This restores the affected CI gates and prevents a failed fixture from leaving its spawn observer installed for later cases.

Why This Change Was Made

Companion prompt representation now has a small, separate owner; its formatting and sanitization bodies are unchanged. The metadata lifecycle fixture uses Node's native immediate promise for its two existing event-loop barriers.

The Doctor fixture now installs its observer explicitly and restores the captured implementation in finally, before asynchronous database cleanup. This avoids the fulfillment-only restoration of Vitest's withImplementation and removes the intermediate boxed result.

The child-role assertions landed concurrently through #145043. They are preserved in full: one reusable reader, balanced staging custodians, every child joined, and the startup migration checkpoint. The original observation slice came from Peter Steinberger's work in #151025; co-author credit is retained. No broader startup changes from that PR are included.

Related: #157940.

Evidence

  • Gateway native proof: all 60 cases across the three companion suites and metadata lifecycle suite passed before and after the mechanical change. Targeted formatting/lint, core types, all 25 selected test-type graphs, and the full build passed, including SDK exports and the UI build gate.
  • Doctor native proof: all five pending-read cases, targeted formatting/lint, and the commands-doctor type graph passed.
  • Both native workers completed and closed. The integrated head retains the exact four reviewed and tested file bodies; it also preserves the newly landed Doctor production changes. Current-head hosted CI and review qualify that new-base integration separately.
  • Four files, 144 additions / 141 deletions. Production: 135 additions / 124 deletions, from separating the existing prompt representation owner. Tests: 9 additions / 17 deletions. No lint limit, assertion, or timeout was relaxed.

The build emitted its existing UI size advisory while passing the hard limit; this change makes no UI runtime or performance claim.

vincentkoc and others added 2 commits September 25, 2026 18:25
Move private-reference representation helpers without changing companion execution or lifecycle behavior. Use native immediate promises for the two metadata fixture event-loop barriers.
Observe native IPC request roles so the snapshot reader and staging custodian retain separate lifecycle assertions. Preserve the startup migration checkpoint and restore the spawn mock on rejection.

Co-authored-by: Peter Steinberger <[email protected]>
@vincentkoc vincentkoc self-assigned this Sep 25, 2026
@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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations size: M labels Sep 25, 2026
Integrate the frozen native main checkpoint. Retain the landed child-role assertions and current production behavior; keep the tested explicit spawn-mock restoration on rejection.
@vincentkoc vincentkoc changed the title fix(ci): repair Gateway lint and Doctor child-process assertions fix(ci): repair Gateway lint and Doctor mock cleanup Sep 25, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 25, 2026 10:31
@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 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 6:48 AM ET / 10:48 UTC.

ClawSweeper review

What this changes

The branch moves Side chat prompt formatting into a private Gateway module, replaces two test event-loop barriers with Node’s promise API, and restores the Doctor fixture’s child-process observer on every exit.

Merge readiness

✅ Ready for maintainer review

Keep open: this is the active, bounded repair for the Gateway lint failures. The alternative PR was closed unmerged in favor of this branch, and the pinned diff has no concrete correctness finding.

Priority: P3
Reviewed head: e2f1df0933678a71d36abd692cc66234be9add11

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused and source-consistent, with useful native-check context; the linked canceled workflows limit independently confirmed proof.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This MEMBER-authored internal CI and fixture repair is exempt from external contributor real-setup proof. Source comparison shows the Gateway prompt bodies and dispatch call points are preserved; the Doctor test observes real child processes, although the linked Testbox workflows ended canceled and their claimed per-case results were not independently verified here. No stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored internal CI and fixture repair is exempt from external contributor real-setup proof. Source comparison shows the Gateway prompt bodies and dispatch call points are preserved; the Doctor test observes real child processes, although the linked Testbox workflows ended canceled and their claimed per-case results were not independently verified here. No stored-data contract changes.
Evidence reviewed 9 items Pinned production change: The introduced patch moves the existing reference formatting, note selection, message composition, and answer sanitization bodies into one private module; the Gateway ask path calls those functions at the same points.
Current main still needs the extraction: Current main retains the original prompt helpers in the ask owner, and the new prompt module is absent. The relevant four paths have no changes between the pinned base and fetched main.
Lint contract: The repository applies a 700 counted-line limit to production TypeScript and a 1000 counted-line limit to test files; the related PR reports exact pre-repair violations of both limits.
Findings None None.
Security None None.

How this fits together

Control UI Side chat sends a question to the Gateway, which combines selected-session context and observer notes into a prompt for a utility model and returns a bounded answer. Separately, the Doctor preflight test observes child processes used for SQLite reads.

flowchart LR
A[Control UI question] --> B[Gateway Side chat RPC]
B --> C[Session context and notes]
C --> D[Private prompt formatter]
D --> E[Utility model]
E --> F[Side chat answer]
G[Doctor preflight test] --> H[SQLite child observation]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +11, Tests -8. Total +3 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 135 124 +11
Tests 2 9 17 -8
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 144 141 +3

Review metrics

None.

Root-cause cluster

Relationship: canonical
Canonical: #158074
Summary: The closed alternative extraction was explicitly superseded by this open PR; the merged Doctor work supplies adjacent fixture assertions.

Members:

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

Technical review

Best possible solution:

Keep one private prompt formatter behind the Gateway companion runtime, preserve Side chat’s existing answer semantics, and make the Doctor fixture restore its real child launcher on every exit.

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

Yes for the lint failures: current main retains the affected owner bodies under the existing line-limit rules, and the related PR records the exact violations. The Doctor rejection cleanup was not independently executed in this read-only review.

Is this the best way to solve the issue?

Yes. The private extraction preserves the formatter bodies and call points, while explicit finally cleanup addresses the fixture lifetime without weakening its child assertions.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This repairs internal lint and fixture cleanup without a demonstrated user-facing behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored internal CI and fixture repair is exempt from external contributor real-setup proof. Source comparison shows the Gateway prompt bodies and dispatch call points are preserved; the Doctor test observes real child processes, although the linked Testbox workflows ended canceled and their claimed per-case results were not independently verified here. No stored-data contract changes.

Label justifications:

  • P3: This repairs internal lint and fixture cleanup without a demonstrated user-facing behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored internal CI and fixture repair is exempt from external contributor real-setup proof. Source comparison shows the Gateway prompt bodies and dispatch call points are preserved; the Doctor test observes real child processes, although the linked Testbox workflows ended canceled and their claimed per-case results were not independently verified here. No stored-data contract changes.

Evidence

What I checked:

  • Pinned production change: The introduced patch moves the existing reference formatting, note selection, message composition, and answer sanitization bodies into one private module; the Gateway ask path calls those functions at the same points. (src/gateway/session-companion-prompt.ts:39, e2f1df093367)
  • Current main still needs the extraction: Current main retains the original prompt helpers in the ask owner, and the new prompt module is absent. The relevant four paths have no changes between the pinned base and fetched main. (src/gateway/session-companion-ask.ts:359, c46b51b87d8d)
  • Lint contract: The repository applies a 700 counted-line limit to production TypeScript and a 1000 counted-line limit to test files; the related PR reports exact pre-repair violations of both limits. (.oxlintrc.json:328, e2f1df093367)
  • Doctor fixture cleanup: The observer is installed explicitly and its captured implementation is restored in finally before asynchronous database cleanup. The existing real-child lifecycle assertions remain. (src/commands/doctor-config-preflight.pending-read.test.ts:134, e2f1df093367)
  • Separate Side chat contract: The docs distinguish Side chat’s Gateway RPC thread from BTW’s Codex-backed side-question path. This patch changes Side chat prompt representation, with no affirmative Codex dependency-contract change. Public docs: docs/tools/btw.md. (docs/tools/btw.md:14, e2f1df093367)
  • Alternative PR disposition: A comment on refactor: keep gateway command owners within line limits #158046 explicitly closes that unmerged extraction in favor of this PR; it does not establish that this PR is implemented on main.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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.

@vincentkoc
vincentkoc merged commit cbff337 into main Sep 25, 2026
269 of 271 checks passed
@vincentkoc
vincentkoc deleted the fix-gateway-lint-owner-caps-20260925 branch September 25, 2026 14:02
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
* refactor(gateway): separate companion prompt formatting

Move private-reference representation helpers without changing companion execution or lifecycle behavior. Use native immediate promises for the two metadata fixture event-loop barriers.

* test(doctor): distinguish read-only snapshot child roles

Observe native IPC request roles so the snapshot reader and staging custodian retain separate lifecycle assertions. Preserve the startup migration checkpoint and restore the spawn mock on rejection.

Co-authored-by: Peter Steinberger <[email protected]>

* merge: preserve landed Doctor coverage in CI repair

Integrate the frozen native main checkpoint. Retain the landed child-role assertions and current production behavior; keep the tested explicit spawn-mock restoration on rejection.

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

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