GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(client): surface managed startup stderr by kitlangton · Pull Request #41793 · anomalyco/opencode

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What

Surface actionable stderr when a managed background-service contender exits unsuccessfully. This lets opencode2 service start report the existing port-conflict guidance instead of reducing it to an exit code.

Closes #41696

Before / After

Before: serve --service emitted the actionable port-conflict diagnostic, but Service.ensure spawned it with stdio: "ignore". The managed client saw only Server process exited with code 1 and could continue spawning contenders without exposing the cause.

After: managed contenders continuously retain only the final 8 KiB of stderr. Once a contender closes with a nonzero exit or signal, its startup error includes that tail, so the configured-port remediation reaches the caller.

How

  • packages/client/src/effect/service.ts captures a bounded stderr tail and waits for child close so output is drained before formatting failures.
  • packages/client/src/promise/service.ts mirrors the same behavior without adding an Effect runtime dependency.
  • The stderr pipe and child remain unrefed so a successful detached service does not keep the client alive.
  • Client fixtures verify tail bounding for both APIs; the CLI regression exercises a real child process through the managed Service.ensure boundary using the same actionable conflict text.

Scope

  • Does not change service election, contender limits, spawn cadence, or retry policy.
  • Does not address other startup-failure presentation tracked by V2: critical startup failures should show actionable errors #35158.
  • Does not change the server-side port-conflict diagnostic, which was already actionable.

Testing

  • cd packages/client && bun run test test/service.test.ts test/promise-service.test.ts (21 passed)
  • cd packages/cli && bun run test test/service.test.ts --test-name-pattern "managed service startup reports an actionable port conflict|unrelated managed port occupancy reports an actionable conflict" (2 passed)
  • cd packages/client && bun typecheck
  • cd packages/cli && bun typecheck
  • bunx prettier --check packages/client/src/effect/service.ts packages/client/src/promise/service.ts packages/client/test/service.test.ts packages/client/test/promise-service.test.ts packages/client/test/fixture/service.ts packages/cli/test/service.test.ts
  • Push hook: bun turbo typecheck --concurrency=3 (33 tasks passed)

Flow

sequenceDiagram
    participant Client as Service.ensure
    participant Child as serve --service contender
    Client->>Child: spawn detached with stderr pipe
    Child-->>Client: stderr chunks
    Client->>Client: retain final 8 KiB
    Child-->>Client: close with nonzero exit
    Client-->>Client: append stderr tail to startup error
Loading

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kitlangton
fix(client): surface managed startup stderr
df7fa12
@github-actions github-actions Bot added the contributor label Aug 11, 2026
kitlangton added 3 commits August 11, 2026 17:14
@kitlangton
refactor(client): share service contender handling
1efe923
@kitlangton
fix(client): release startup stderr capture
a28c2b4
@kitlangton
test(cli): remove duplicate startup stderr case
fa3cb4c
@kitlangton
kitlangton marked this pull request as ready for review August 12, 2026 00:39
kitlangton added 2 commits August 11, 2026 21:04
@kitlangton
Merge remote-tracking branch 'origin/v2' into startup-stderr
e0930e2
# ------------------------ >8 ------------------------
# Do not modify or remove the line above.
# Everything below it will be ignored.
#
# Conflicts:
#	packages/client/src/effect/service.ts
#	packages/client/src/promise/service.ts
@kitlangton
Merge remote-tracking branch 'origin/v2' into startup-stderr
bf145f4
@kitlangton
kitlangton merged commit 9322f5d into v2 Aug 12, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@kitlangton
kitlangton deleted the startup-stderr branch August 12, 2026 01:55
@opencode-agent opencode-agent Bot mentioned this pull request Aug 12, 2026
opencode2 became stuck starting its managed background server #41696
Closed
@sghng sghng mentioned this pull request Sep 14, 2026
V2: critical startup failures should show actionable errors #35158
Open
@marwan562 marwan562 mentioned this pull request Sep 18, 2026
v2.0.7: opencode fails at Starting background server with UnknownError Transport Unable to connect (exit 130) #49658
Closed
@yveming yveming mentioned this pull request Sep 22, 2026
service: hardcoded default port 49374 locks out any second client on shared loopback (multi-user/WSL mirrored), surfacing only a generic timeout #50672
Open
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
@kitlangton
fix(client): surface managed startup stderr (anomalyco#41793)
4c36696
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@kitlangton
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.