Skip to content

Mark dev servers live only once a declared readiness probe passes - #1689

Merged
currentbits merged 2 commits into
mainfrom
coder/dev-server-readiness-probes-instead-of-f-bf8a30
Oct 19, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/dev-server-readiness-probes-instead-of-f-bf8a30

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Until now a thread's dev server counted as live as soon as a URL showed up in its log, and the Browser pane auto-loaded it, often before the server could actually serve. Projects can now declare a readiness probe in solenta.json. The URL is offered only once the probe passes. Closes #282.

{ "devServer": { "ready": { "tcp": "$PORT" } } }

Changes

  • devServer.ready takes exactly one of tcp (a port), http (a localhost URL that must answer 2xx/3xx) or exec (a command that must exit 0). There's an optional timeoutMs, default 120s. $PORT and other variables expand from the dev server's own env, so each lane probes its own port.
  • The main process polls every 500 ms. While a declared probe hasn't passed, the logged URL is withheld from devserver:status, so the Browser pane waits. Projects with no probe behave exactly as before.
  • The Dev server card shows the probe state: Waiting for tcp localhost:5173 (ECONNREFUSED), Ready tcp localhost:5173, or Not ready: <error>. On timeout the server keeps running; only the probe is marked failed.
  • site/docs.html documents the key.

Verification

  • electron/test/devservers.test.js: parser units, plus real-process integration for tcp (URL hidden, then shown once the port listens), exec (file flag), http (a 503 times out to failed), and an unset $VAR failing at start. All pass.
  • test/devServer.test.tsx: the card's waiting, failed and ready lines. Passes. tsc --noEmit is clean.
  • Full test:electron in a CI-like clean env: the only failures are in 7 codex/guardrail/orch-server/mcp files. On that subset, a clean HEAD checkout and this branch fail the identical 28 tests.

Notes for reviewers

  • exec probes skip the solenta.json approval prompt. They only run after the user clicks Start on one of the repo's npm scripts, which already runs code from the repo. Say so if you'd rather gate them anyway.
  • http probes are restricted to loopback hosts, so a checked-in file can't make the app fetch arbitrary URLs.
  • Once a probe passes, Solenta doesn't keep re-checking it.
  • If solenta.json isn't valid JSON, no probe runs and behaviour is unchanged. A valid file with a bad devServer.ready fails the probe immediately and shows why.

🤖 Generated with Claude Code

solenta.json can declare devServer.ready as a tcp port, a localhost http
URL, or an exec command. The logged URL is withheld until the probe passes,
so the Browser pane no longer auto-loads a server that is not up yet. The
Dev server card shows the probe state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T08:47:17.134061Z de5d047 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de5d047e2b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread electron/devservers.js
Comment on lines +321 to +323
// A declared probe gates the URL: the Browser pane auto-loads it.
if (rec.url && (!rec.probe || rec.probe.status === "ready")) state.url = rec.url;
if (rec.probe) state.probe = { ...rec.probe };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent server discovery from bypassing readiness gates

When an HTTP or exec probe remains pending after the process opens a port, withholding only state.url does not stop the Browser pane from loading it. BrowserPane.pickSuggestedUrl falls back to listLocalServers, which retains every non-ephemeral listener under the project root, and the pane auto-navigates to that result. Thus, opening the Browser pane after a server begins listening can load it while its declared probe is still waiting or failed; the pending probe must also suppress the discovered-server fallback for this managed server.

Useful? React with 👍 / 👎.

Comment thread electron/devservers.js
Comment on lines +351 to +355
if (why === null) {
state.status = "ready";
state.readyAt = Date.now();
delete state.lastError;
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject probe success that arrives after timeoutMs

If an attempt succeeds after the configured deadline, this branch marks the probe ready without checking elapsed time. For example, { "exec": "sleep 2", "timeoutMs": 1000 } starts its first attempt after the polling delay, runs with the fixed 5-second attempt timeout, and is accepted around 2.5 seconds instead of failing at one second; slow HTTP successes behave similarly. Check the deadline before accepting success and cap each attempt by the remaining total timeout.

Useful? React with 👍 / 👎.

Comment thread electron/devservers.js
Comment on lines +218 to +219
env: ctx.env,
project: ctx.project,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve lane overrides in exec probe environments

For an exec probe, passing both ctx.env and the original project causes runVerifyCommand to spread project.env after input.env, overwriting the lane-specific values already used to launch the server. If project configuration sets PORT=3000 and a claimed lane overrides it to 3001, the server runs on 3001 but an exec probe such as curl localhost:$PORT/health tests 3000. Ensure the probe command receives the exact effective dev-server environment without reapplying lower-precedence project values.

Useful? React with 👍 / 👎.

@currentbits
currentbits merged commit 6bfdcf3 into main Oct 19, 2026
6 checks passed
currentbits pushed a commit that referenced this pull request Oct 19, 2026
docs.html gained the readiness-probe paragraph in #1689 without a rebuild,
so site-llms.test.js failed on main and on every PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
currentbits added a commit that referenced this pull request Oct 19, 2026
…#272) (#1699)

* coder-checkpoint: turn 70

Solenta-Message-Id: 11966517-c619-42ad-a3b4-d2b5bfe76d8b

* coder-checkpoint: turn 71

Solenta-Message-Id: adc9fdbc-6b99-4514-a298-2ac7372c41fb

* Regenerate llms-full.txt for the dev server readiness docs

docs.html gained the readiness-probe paragraph in #1689 without a rebuild,
so site-llms.test.js failed on main and on every PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Stop the replay test crashing on a log it reads mid-write

replay.js polls replay.log while the fake CLI appends to it. An empty file or
a half-written last line threw "Unexpected end of JSON input" on macOS CI
instead of reading as not-done-yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Solenta <solenta@local>
Co-authored-by: Willem <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dev-server readiness probes instead of fixed sleeps

1 participant