Skip to content

refactor: simplify Gateway health response parsing - #147834

Merged
steipete merged 1 commit into
mainfrom
codex/refactor-gateway-health-response-parsing
Sep 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/refactor-gateway-health-response-parsing

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Gateway health reader repeats object checks and uses type assertions while extracting plugin and channel diagnostics.

User Impact

No user-visible behavior change. Health fields, diagnostic messages, restart/update timing, recovery decisions and service commands remain unchanged.

Why This Change Was Made

Use the existing record-coercion owner and construct typed plugin errors only after validating their fields. This removes seven assertions and 21 production lines. The obsolete seven-assertion allowance is removed from the ratchet baseline as exact shrink-only maintenance.

Evidence

The three existing mocked restart cases, formatting, all 30 sections of the selected changed-file gate and final diff checks passed. The unchanged production diff has clean independent P2 review; the subsequent metadata deletion was verified against the ratchet owner.

The published v2026.9.4 reader and candidate matched on 471 serialized JSON cases. The published-updater package cell also passed: exactly one 2026.9.3/base upgrade to this candidate, including automatic migration before Doctor, retained-state checks, startup, health/readiness and RPC. The package hash and source were verified. This cell uses manual restart; detailed recovery receipts were not uploaded, so it does not establish a clean first update attempt or updater-owned restart. No operator Gateway or service was modified.

The initial PR CI run failed an unchanged CUA process-cleanup test. A single isolated diagnostic passed through the real CUA/cleanup entry on the same Linux x86_64 and Node 24.19.0 runtime. Both process/output and extinction waits settled successfully; the original failure remains unexplained. The failed-job retry is tracked separately from the parser and package proof.

Maintainer assessment

The documented package-proof limits are acceptable for this bounded refactor. The changed code only extracts plugin and channel diagnostics from serialized health responses; authentication, restart/update orchestration, recovery and service commands are unchanged. Existing restart tests exercise the diagnostic decisions, 471 serialized cases establish reader parity, and the published 2026.9.3/candidate package cell passed migration, retained-state, startup, health/readiness and RPC checks.

Manual restart and the unavailable detailed recovery receipts remain explicit limits. They do not identify an introduced failure in the changed readers. The original CUA cleanup failure also remains unexplained; its matching-runtime diagnostic and CI retry passed. This assessment resolves ClawSweeper's merge-risk decision for the parser change, with normal native review and merge gates still required.

@steipete
steipete marked this pull request as ready for review September 14, 2026 03:44
@clawsweeper

clawsweeper Bot commented Sep 14, 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 cli CLI command changes size: S maintainer Maintainer-authored PR labels Sep 14, 2026
@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 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 3:43 AM ET / 07:43 UTC (Revision 3).

ClawSweeper review

What this changes

Simplifies Gateway health diagnostic parsing with the existing record-validation helper and removes the obsolete type-assertion allowance.

Merge readiness

✅ Ready for maintainer review

No blocking defect found. The refactor remains distinct from current main, and the maintainer’s assessment resolves the previous proof-scope decision. This protected PR can proceed through normal merge gates.

Priority: P3
Reviewed head: ea732ef3123cb44309fce2ca3a8f32338768f06b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable refactor with accepted bounded proof and no actionable correctness or security findings.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): Preserve the accepted package proof: the captured body connects the candidate health readers to published-upgrade startup, health/readiness, and RPC checks, with 471 serialized parity cases as supplemental coverage. Manual restart and unavailable recovery receipts limit broader updater claims; the maintainer explicitly accepted those limits, and blocked reviewer log access does not invalidate the evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Preserve the accepted package proof: the captured body connects the candidate health readers to published-upgrade startup, health/readiness, and RPC checks, with 471 serialized parity cases as supplemental coverage. Manual restart and unavailable recovery receipts limit broader updater claims; the maintainer explicitly accepted those limits, and blocked reviewer log access does not invalidate the evidence.
Evidence reviewed 8 items Verified introduced scope: The pinned introduction changes only the two diagnostic readers and their obsolete assertion allowance. The verified test merge has the recorded base and PR head as its parents and changes those same two paths.
Shared validation preserves serialized response behavior: The helper accepts non-null, non-array objects. Both readers retain their required-field checks, optional diagnostic fields, ordering, and fallback text. Serialized arrays cannot carry the named properties required by the former readers. The unchanged unavailable-plugin reader already uses this helper.
Existing behavioral coverage: Three existing mocked restart cases verify activated-plugin diagnostics, immediate plugin-error termination, and immediate channel-error termination through the restart entry points. They remain supplemental evidence; no tests or target code were executed in this read-only review.
Findings None None.
Security None None.

How this fits together

The CLI reads Gateway health responses during restart verification. Plugin and channel errors feed restart health decisions and operator-facing diagnostics.

flowchart LR
  A[Gateway health response] --> B[Validate diagnostic records]
  B --> C[Activated plugin errors]
  B --> D[Channel probe errors]
  C --> E[Restart health decision]
  D --> E
  E --> F[CLI diagnostics]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -21, Other -1. Total -22 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 32 53 -21
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 2 32 54 -22

Review metrics

Metric Value Why it matters
Assertion allowance 7 → 0 for the health reader The baseline removal exactly follows the eliminated assertions without expanding an exception.

Technical review

Best possible solution:

Keep diagnostic extraction on the shared record-validation owner while preserving restart decisions, messages, and update behavior.

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

Not applicable: this PR addresses internal parsing duplication, and no concrete behavioral regression was found during source review.

Is this the best way to solve the issue?

Yes: reusing the existing record helper removes assertions without adding a competing parser, public API, or compatibility path.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is bounded internal cleanup with no intended user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Preserve the accepted package proof: the captured body connects the candidate health readers to published-upgrade startup, health/readiness, and RPC checks, with 471 serialized parity cases as supplemental coverage. Manual restart and unavailable recovery receipts limit broader updater claims; the maintainer explicitly accepted those limits, and blocked reviewer log access does not invalidate the evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. Preserve the accepted package proof: the captured body connects the candidate health readers to published-upgrade startup, health/readiness, and RPC checks, with 471 serialized parity cases as supplemental coverage. Manual restart and unavailable recovery receipts limit broader updater claims; the maintainer explicitly accepted those limits, and blocked reviewer log access does not invalidate the evidence.

Evidence

What I checked:

  • Verified introduced scope: The pinned introduction changes only the two diagnostic readers and their obsolete assertion allowance. The verified test merge has the recorded base and PR head as its parents and changes those same two paths. (src/cli/daemon-cli/restart-health-probe.ts:150, ea732ef3123c)
  • Shared validation preserves serialized response behavior: The helper accepts non-null, non-array objects. Both readers retain their required-field checks, optional diagnostic fields, ordering, and fallback text. Serialized arrays cannot carry the named properties required by the former readers. The unchanged unavailable-plugin reader already uses this helper. (packages/normalization-core/src/record-coerce.ts:21, ea732ef3123c)
  • Existing behavioral coverage: Three existing mocked restart cases verify activated-plugin diagnostics, immediate plugin-error termination, and immediate channel-error termination through the restart entry points. They remain supplemental evidence; no tests or target code were executed in this read-only review. (src/cli/daemon-cli/restart-health-probe.test.ts:402, ea732ef3123c)
  • Still distinct from main and release: Fetched main retains the assertion-based readers. The v2026.9.4 source retrieved through GitHub also retains them; this cleanup is not already implemented in either inspected revision. (src/cli/daemon-cli/restart-health-probe.ts:150, 0d081a0ee88a)
  • Proof and prior-review disposition: The complete captured PR body reports parity across 471 serialized cases and a published 2026.9.3-to-candidate package cell covering migration, retained state, startup, health/readiness, and RPC. Its maintainer assessment explicitly accepts manual restart and missing detailed recovery receipts for this parser-only change. The prior review had no findings and assessed the identical head. Captured context sourceRevision: b48479c6bb4fb3b57c0da074552f06d8b49cfe401e409993034df8fbf92d6344. (ea732ef3123c)
  • Package run independently checked: https://github.com/openclaw/openclaw/actions/runs/34808326846 completed successfully, including the published-upgrade-survivor job. The run's workflow head is separate from candidate identity. Raw job-log retrieval was blocked by the artifact-storage allowlist, so candidate binding and detailed observations remain supported by the captured proof account rather than independently inspected receipts.

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-14T03:56:23.675Z sha ea732ef :: blocked before merge. :: none
  • reviewed 2026-09-14T06:09:01.799Z sha ea732ef :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 14, 2026
@steipete
steipete merged commit 8e6fe8e into main Sep 14, 2026
406 of 409 checks passed
@steipete
steipete deleted the codex/refactor-gateway-health-response-parsing branch September 14, 2026 07:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 14, 2026
* commit '8e6fe8e02ddb51bfec4e80071f0f2adcae4cf098': (47 commits)
  refactor: simplify Gateway health response parsing (#147834)
  fix: avoid Gateway stalls when renaming sessions (#147869)
  refactor(plugins): reuse worker optional-method validation (#147925)
  refactor(infra): remove unreachable firewall diagnostic fallback (#147882)
  fix(ui): open attached automations from session hovercards (#147749)
  refactor(reply): share usage-bar numeric coercion (#147863)
  fix(doctor): report warnings for keyed agent configs (#123058)
  perf(plugins): reuse complete registry comparisons (#147893)
  fix(workboard): await lifecycle sweep completion in tests (#147950)
  fix: reduce stalls when browsing large session inventories (#147911)
  refactor(onboard): share custom model definition (#147915)
  feat(ios): collapse completed chat work above replies (#148002)
  fix(voice-call): retain state runtime for deferred streams (#147689)
  test(qa): compare Telegram entities semantically (#147752)
  fix(plugins): preserve runtime scope for deferred CLI actions (#147688)
  test(qa): keep Slack progress marker visible (#147748)
  test(qa): finish channel picker prompts (#147730)
  test(tui): handle auth restriction prompt (#147729)
  fix(qa): retain onboarding prompts across redraw bursts (#147687)
  fix(qa): seed Teams ambiguous timeout deterministically (#147686)
  ...
vincentkoc added a commit to SunnyShu0925/openclaw that referenced this pull request Sep 14, 2026
* commit '069710f909f0a7158777d0fc0bf1eab84e20c699': (45 commits)
  refactor(infra): consolidate update campaign reset ownership (openclaw#146555)
  refactor: simplify Gateway health response parsing (openclaw#147834)
  fix: avoid Gateway stalls when renaming sessions (openclaw#147869)
  refactor(plugins): reuse worker optional-method validation (openclaw#147925)
  refactor(infra): remove unreachable firewall diagnostic fallback (openclaw#147882)
  fix(ui): open attached automations from session hovercards (openclaw#147749)
  refactor(reply): share usage-bar numeric coercion (openclaw#147863)
  fix(doctor): report warnings for keyed agent configs (openclaw#123058)
  perf(plugins): reuse complete registry comparisons (openclaw#147893)
  fix(workboard): await lifecycle sweep completion in tests (openclaw#147950)
  fix: reduce stalls when browsing large session inventories (openclaw#147911)
  refactor(onboard): share custom model definition (openclaw#147915)
  feat(ios): collapse completed chat work above replies (openclaw#148002)
  fix(voice-call): retain state runtime for deferred streams (openclaw#147689)
  test(qa): compare Telegram entities semantically (openclaw#147752)
  fix(plugins): preserve runtime scope for deferred CLI actions (openclaw#147688)
  test(qa): keep Slack progress marker visible (openclaw#147748)
  test(qa): finish channel picker prompts (openclaw#147730)
  test(tui): handle auth restriction prompt (openclaw#147729)
  fix(qa): retain onboarding prompts across redraw bursts (openclaw#147687)
  ...
vincentkoc added a commit that referenced this pull request Sep 14, 2026
* commit 'a08cdc50bc049074ed7ad2db9e18e0ed3f5415ec': (81 commits)
  perf: reuse stateless plugin scope defaults (#148080)
  fix(gateway): flush slow-consumer 1008 close frame before terminating socket (#147707)
  fix: keep model catalogs loading during other session updates (#147878)
  fix: show queued external chat messages and their source (#147848)
  refactor(chat): share math label configuration (#148073)
  perf(ui): trim eager debug overlay icon payload (#147954)
  improve(logbook): sample batch frame metadata in SQLite (#147999)
  fix(ui): dismiss suggested task cards without waiting (#148021)
  fix(maturity): cover governance, interoperability, fleet, and state (#143528)
  chore(ui): restore core lint and startup budget checks (#148010)
  fix: chat startup loads unnecessary session setup text (#147973)
  perf: speed up fresh cloud worker activation (#147945)
  fix: recover PR preparation after committed merge conflicts (#148063)
  test(plugins): isolate ClawHub Docker fixture identity (#148074)
  fix(release): acknowledge ClawHub risk on moving installs (#148041)
  fix: restore context reads for installed official Discord and Slack plugins (#143341)
  fix: identify source capsule filesystem failures (#147778)
  fix(linux): keep Quick Chat widgets bound to their Gateway (#146049)
  refactor(infra): consolidate update campaign reset ownership (#146555)
  refactor: simplify Gateway health response parsing (#147834)
  ...
vincentkoc added a commit to nvtoroy/openclaw that referenced this pull request Sep 15, 2026
* commit '7d485aa2e89af7fdbd09e8ed0489b06d250b07e3':
  test(scripts): check the configurable ClawHub sweep spec
  fix: show queued external chat messages and their source (openclaw#147848)
  refactor(chat): share math label configuration (openclaw#148073)
  perf(ui): trim eager debug overlay icon payload (openclaw#147954)
  improve(logbook): sample batch frame metadata in SQLite (openclaw#147999)
  fix(ui): dismiss suggested task cards without waiting (openclaw#148021)
  fix(maturity): cover governance, interoperability, fleet, and state (openclaw#143528)
  chore(ui): restore core lint and startup budget checks (openclaw#148010)
  fix: chat startup loads unnecessary session setup text (openclaw#147973)
  perf: speed up fresh cloud worker activation (openclaw#147945)
  fix: recover PR preparation after committed merge conflicts (openclaw#148063)
  test(plugins): isolate ClawHub Docker fixture identity (openclaw#148074)
  fix(release): acknowledge ClawHub risk on moving installs (openclaw#148041)
  fix: restore context reads for installed official Discord and Slack plugins (openclaw#143341)
  fix: identify source capsule filesystem failures (openclaw#147778)
  fix(linux): keep Quick Chat widgets bound to their Gateway (openclaw#146049)
  refactor(infra): consolidate update campaign reset ownership (openclaw#146555)
  refactor: simplify Gateway health response parsing (openclaw#147834)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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