effect(installation): migrate to AppProcess.run#27188
Merged
Merged
Conversation
ebc8050 to
bf596d5
Compare
ce58e16 to
274f96a
Compare
274f96a to
fa1c876
Compare
3ccea03 to
acf80a3
Compare
fa1c876 to
fc91523
Compare
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
avion23
pushed a commit
to avion23/opencode
that referenced
this pull request
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Phase 2.1 of the AppProcess migration, stacked on #27178.
Summary
Replaces the spawn-and-collect dance in
src/installation/index.tswithAppProcess.run. The service now yieldsAppProcess.Serviceinstead ofChildProcessSpawner.ChildProcessSpawner, anddefaultLayerprovidesAppProcess.defaultLayer(which providesCrossSpawnSpawnerunderneath).Call sites migrated
packages/opencode/src/installation/index.ts:text(cmd, opts)(was lines 96-110): spawn -> collect stdout viaStream.mkString-> await exit code -> catch -> "". Now: singleappProcess.run(ChildProcess.make(...), { interpretExitCode: acceptAnyExit })then.stdout.toString("utf8").run(cmd, opts)(was lines 112-129): spawn -> collect stdout+stderr concurrently -> exit code -> catch -> default failure. Now: singleappProcess.runwithacceptAnyExitso caller can inspect.exitCodeitself (preserves prior behavior where non-zero exits were not failures).upgradeCurl(target)(was lines 139-159): spawn bash with piped stdin, collect, exit. Now:appProcess.run(ChildProcess.make("bash", [], { stdin: Stream.make(bodyBytes), ... }), { interpretExitCode: acceptAnyExit }).Layer dependency change:
Layer.Layer<Service, never, HttpClient.HttpClient | ChildProcessSpawner.ChildProcessSpawner>Layer.Layer<Service, never, HttpClient.HttpClient | AppProcess.Service>defaultLayer: dropped directCrossSpawnSpawner.defaultLayer(now provided viaAppProcess.defaultLayer).Behavior preservation
All three helpers needed
interpretExitCode: () => "success"(aliasedacceptAnyExit). The pre-existing helpers ignored the exit code on purpose:textis used inmethod()to probe package managers that may not be installed (e.g.,npm list -gon a system without npm). Non-zero exit must not throw.runreturns{ code, stdout, stderr }, and callers explicitly checkcode !== 0(e.g.,tap.code !== 0,pull.code !== 0). LettingAppProcessfail on non-zero would losestdout/stderrfrom the caller's check.upgradeCurlshares therun-style return shape; the existingEffect.orDieonly covers spawn failures, not non-zero exits.So I used
acceptAnyExitrather than custom catch translation. TheEffect.catch(() => "")/Effect.catch(() => { code: 1, ... })wrappers are kept to handle spawn-time failures (AppProcessError), matching prior semantics.Test updates:
test/installation/installation.test.tscomposesAppProcess.layerover the existingmockSpawner(which providesChildProcessSpawner) so the mock spawner still drives the test. All 9 existing tests pass.LOC delta
packages/opencode/src/installation/index.ts: -1 line (211 insertions, 212 deletions).Verification
bun run typecheck(clean)bun run test test/installation/installation.test.ts-> 9 passTest plan