Skip to content

fix: avoid gateway daemon repair on protocol mismatch#87205

Closed
rifachnia wants to merge 3 commits into
openclaw:mainfrom
rifachnia:fix/doctor-repair-stale-gateway-service
Closed

fix: avoid gateway daemon repair on protocol mismatch#87205
rifachnia wants to merge 3 commits into
openclaw:mainfrom
rifachnia:fix/doctor-repair-stale-gateway-service

Conversation

@rifachnia

Copy link
Copy Markdown

Summary

  • Detect protocol mismatch explicitly during doctor gateway health checks
  • Avoid treating incompatible running gateways as dead/stale gateways
  • Skip daemon repair flow for protocol mismatch states
  • Add regression coverage for protocol mismatch handling and repair skipping

Related #87156

Real behavior proof

Behavior addressed:

  • Protocol mismatch previously propagated as healthOk=false, causing openclaw doctor to treat a running gateway as dead/stale and enter daemon repair flow.

Real environment tested:

  • Native Windows 11
  • Git/source checkout
  • Existing gateway service on port 18789
  • Startup-folder fallback runtime active

Exact steps or command run after this patch:

openclaw gateway status
npm run openclaw -- doctor --deep

Evidence after fix:

  • gateway status still reported:

    • Connectivity probe: failed
    • protocol mismatch
  • but doctor --deep:

    • completed successfully
    • no longer printed Gateway not running
    • did not trigger daemon repair/reinstall flow

Observed result:

  • Protocol mismatch is now treated as an incompatibility state instead of a dead gateway state.

Not tested:

  • Scheduled Task migration flows
  • Automatic gateway restart after update
  • Non-Windows environments

Tests

npm test -- src/commands/doctor-gateway-health.test.ts src/commands/doctor-gateway-daemon-flow.test.ts

npm run typecheck

npm run lint

Regression coverage added:

  • protocol mismatch health classification
  • skipping daemon repair flow during protocol mismatch

Validation result:

  • targeted protocol mismatch tests pass
  • oxlint clean
  • no new typecheck errors in touched files
  • one unrelated existing Windows test failure remains (/tmp/ hardcoded handoff env expectation)

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 27, 2026
@clawsweeper

This comment has been minimized.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels May 27, 2026
@clawsweeper

clawsweeper Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Brave Clawlet

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: sniffs out flaky tests.
Image traits: location merge queue dock; accessory release bell; palette pearl, teal, and neon green; mood celebratory; pose nestled inside a glowing shell; shell frosted glass shell; lighting cool dashboard glow; background tiny shells and proof notes.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Brave Clawlet in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@rifachnia
rifachnia force-pushed the fix/doctor-repair-stale-gateway-service branch from 7c67bdd to 9874d45 Compare May 27, 2026 07:43
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels May 27, 2026
@rifachnia

Copy link
Copy Markdown
Author

Real behavior proof update

After-fix evidence from a native Windows source-checkout environment:

$ openclaw gateway status

Runtime: running (pid 23208, Startup-folder login item installed; listener detected on port 18789.)
Connectivity probe: failed
Probe target: ws://127.0.0.1:18789
  protocol mismatch
Capability: unknown

$ npm run openclaw -- doctor --deep

OpenClaw 2026.5.26 (7c67bdd)
...
—  Doctor complete.

Observed result:

  • The running gateway still reproduced protocol mismatch.
  • doctor --deep completed successfully.
  • doctor --deep did not print Gateway not running.
  • doctor --deep did not enter the dead-gateway daemon install/start repair flow.
  • Stale service-definition checks still run before the protocol-mismatch skip.

@rifachnia

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 27, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 27, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 May 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 29, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 29, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels May 29, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 29, 2026
@vincentkoc
vincentkoc force-pushed the fix/doctor-repair-stale-gateway-service branch from 9874d45 to 06c698b Compare July 6, 2026 21:53
@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label Jul 6, 2026
@vincentkoc vincentkoc self-assigned this Jul 6, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 6, 2026
@vincentkoc

Copy link
Copy Markdown
Member

No description provided.

@vincentkoc vincentkoc removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 6, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Closing as superseded by #101213.

That merged repair fixes the actual Windows update/doctor failure reported in #87156: it captures the running Startup-folder fallback, preserves auth, installs and verifies the replacement Scheduled Task, restarts repaired gateways, and rolls back if takeover cannot be proven. The issue is now closed by that landed fix with native Windows evidence.

This PR instead adds a broader policy that treats any typed protocol mismatch as a reason to skip daemon repair mutations. We do not want to retain that separate behavior after fixing the owning update/fallback path, because protocol mismatch can occur outside the reported Windows scenario and should not globally suppress otherwise-valid recovery.

Thanks for the focused reproduction and tests; they helped isolate the failure while the canonical repair was being built.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P2 Normal backlog priority with limited blast radius. 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.

3 participants