Skip to content

fix(setup): remove post-install gateway port ownership heuristic - #1334

Closed
Elliot-Construct wants to merge 2 commits into
openclaw:mainfrom
Elliot-Construct:fix/start-gateway-port-heuristic
Closed

Elliot-Construct wants to merge 2 commits into
openclaw:mainfrom
Elliot-Construct:fix/start-gateway-port-heuristic

Conversation

@Elliot-Construct

Copy link
Copy Markdown

Summary

Remove the post-install ss -tlnp process-name ownership heuristic from StartGatewayStep.

openclaw gateway install --force can already start/restart the managed gateway service. The subsequent start step should therefore use the idempotent openclaw gateway start path and existing health polling instead of rejecting a listener purely because ss does not expose a process name.

This avoids false Port 18789 is already in use by another process failures when the listener is the gateway service just installed by setup.

Regression

The first commit intentionally adds a failing regression test only. It asserts that normal startup does not run the ss -tlnp ownership probe and still invokes openclaw gateway start followed by health checking.

Intended lifecycle

install -> gateway start -> health check

This supersedes the narrower process-name workaround discussed in #547, because ss may expose node, openclaw, or no process identity at all.

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

🦞👀
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.

@Elliot-Construct
Elliot-Construct marked this pull request as ready for review September 5, 2026 13:37
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. 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 Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed September 5, 2026, 9:41 AM ET / 13:41 UTC.

ClawSweeper review

What this changes

Removes setup’s process-name-based gateway port check and adds a regression test so startup proceeds through the existing service-start and health-check path.

Merge readiness

⛔ Blocked before merge - 4 items remain

This remains a useful, focused fix: the faulty check is present on main and in the latest release, while the related earlier PR closed unmerged. No definite introduced code defect was found, but the submitted evidence does not establish real Windows/WSL behavior.

Priority: P0
Reviewed head: f8f43dc6871221729f508f9ffe019527cbd3635d

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and source-supported, but mocked evidence leaves the required real setup proof gate unmet.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: StartGatewayStep's post-install start and health transition is exercised only through a fake command runner; no submitted current-head Windows/WSL output shows successful real service startup or repeated-start behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: StartGatewayStep's post-install start and health transition is exercised only through a fake command runner; no submitted current-head Windows/WSL output shows successful real service startup or repeated-start behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 11 items Repository policy: Read the complete root AGENTS.md and applicable proof-validation skill. No additional ancestor AGENTS.md applies to either changed file, and no maintainer-notes directory exists. Setup changes require declared proof pools, validation results, and current-head real behavior evidence.
Verified introduced change: The merge-base-to-head diff contains only the 19-line production deletion and an 80-line test addition. Raw test-merge parents also match the pinned main followed by the exact PR head.
Main still contains the defect: Normal startup rejects a nonempty matching listener line unless its text contains openclaw. A gateway listener reported as node or without process information therefore fails before the service-start command.
Findings None None.
Security None None.

How this fits together

Windows setup installs the gateway service inside WSL, starts it, and checks HTTP readiness before pairing the operator and node. Initial port availability and credential endpoint authorization have separate checks.

flowchart TD
  A[Setup configuration] --> B[Initial port availability check]
  B --> C[Install gateway service in WSL]
  C --> D[Start gateway service]
  D --> E{Startup and health succeed?}
  E -->|Yes| F[Verify endpoint and pair]
  E -->|No| G[Report failure and roll back]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: StartGatewayStep's post-install start and health transition is exercised only through a fake command runner; no submitted current-head Windows/WSL output shows successful real service startup or repeated-start behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - If a competing HTTP listener appears after preflight, the remaining health check can accept its response when the upstream start command reports success; genuine-conflict behavior has not been demonstrated.
  • Resolve merge risk (P1) - Fresh setup and repeated startup against an existing service have no submitted current-head runtime evidence.
  • Complete next step (P2) - Add current-head real Windows/WSL proof and required validation results under the repository's proof sections, including fresh setup, already-running service startup, and genuine-conflict handling. Terminal output or redacted logs are sufficient; screenshots or video are welcome when useful. Redact tokens, private endpoints, IP addresses, and personal details. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production -19 lines; tests +80 lines The patch removes a heuristic and adds one focused regression test without growing production code.

Merge-risk options

Maintainer options:

  1. Verify genuine conflicts before landing (recommended)
    Provide supported-Gateway runtime evidence that a competing listener cannot be reported as a successfully started gateway after removing the heuristic.

Technical review

Best possible solution:

Use the managed service lifecycle with proven fresh and existing-service behavior, genuine-conflict detection, and actionable in-app recovery for startup failures.

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

Yes, from source: a matching listener line without openclaw causes main to reject startup before invoking the gateway CLI. No live reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Yes, provisionally: using the existing service lifecycle is narrower than expanding the process-name allowlist, provided real setup evidence confirms already-running services and genuine conflicts behave correctly.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P0: The source-backed false conflict blocks first-run setup and directs users toward stopping processes or editing setup configuration, triggering the onboarding UX priority override.
  • add merge-risk: 🚨 availability: Removing the post-install listener rejection leaves genuine bind-conflict detection dependent on the Gateway CLI and a generic HTTP readiness check.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: StartGatewayStep's post-install start and health transition is exercised only through a fake command runner; no submitted current-head Windows/WSL output shows successful real service startup or repeated-start behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P0: The source-backed false conflict blocks first-run setup and directs users toward stopping processes or editing setup configuration, triggering the onboarding UX priority override.
  • merge-risk: 🚨 availability: Removing the post-install listener rejection leaves genuine bind-conflict detection dependent on the Gateway CLI and a generic HTTP readiness check.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: StartGatewayStep's post-install start and health transition is exercised only through a fake command runner; no submitted current-head Windows/WSL output shows successful real service startup or repeated-start behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Repository policy: Read the complete root AGENTS.md and applicable proof-validation skill. No additional ancestor AGENTS.md applies to either changed file, and no maintainer-notes directory exists. Setup changes require declared proof pools, validation results, and current-head real behavior evidence. (AGENTS.md:68, f8f43dc68712)
  • Verified introduced change: The merge-base-to-head diff contains only the 19-line production deletion and an 80-line test addition. Raw test-merge parents also match the pinned main followed by the exact PR head. (src/OpenClaw.SetupEngine/StartGatewayStep.cs:36, f8f43dc68712)
  • Main still contains the defect: Normal startup rejects a nonempty matching listener line unless its text contains openclaw. A gateway listener reported as node or without process information therefore fails before the service-start command. (src/OpenClaw.SetupEngine/StartGatewayStep.cs:44, 305bb4ef5334)
  • Latest release comparison: The supplied latest release, v2026.7.1-4, contains the same process-name rejection. This requested fix is not already present there. (src/OpenClaw.SetupEngine/StartGatewayStep.cs:44, c7c6fb06be03)
  • Existing lifecycle and conflict handling: The default pipeline checks port availability before installing the service, then immediately runs StartGatewayStep. The patch retains command exit handling and health polling; that polling accepts HTTP 200, 401, or 403 without identifying the responding service. (src/OpenClaw.SetupEngine/StartGatewayStep.cs:84, f8f43dc68712)
  • Credential authorization remains separate: Operator pairing checks managed endpoint provenance before connection and installs authorization callbacks for reconnect and handshake credential delivery. Removing the earlier process-name heuristic does not remove these authorization checks. (src/OpenClaw.SetupEngine/PairOperatorStep.cs:81, f8f43dc68712)

Likely related people:

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

Rank-up moves

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

  • Add current-head Windows/WSL evidence covering fresh setup, an already-running managed service, and a genuine competing listener.
  • Declare windows-wsl-gateway-e2e and record required build, Shared, Tray, focused SetupEngine, and applicable gateway/MXC validation results or explicit blockers.

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.

@Elliot-Construct

Elliot-Construct commented Sep 5, 2026 •

Copy link
Copy Markdown
Author

Also I was messaging one of the maintainers in the contributor channel in discord and all of a sudden I got kicked out of the server? Not sure why? I was specifically answering questions he had. @ngutman

@karkarl

karkarl commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Closing as superseded. #1349 preserved the diagnosis and replaced this PR's removal of ownership verification with a safer PID-based service ownership check. #1349 has now been superseded by #1382, which transplants that fix onto current main with strengthened diagnostics, coverage, and real setup E2E proof.

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

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants