chore(server): log and bound instance service bootstrap - #46167
Open
CannonRS wants to merge 1 commit into
Open
Conversation
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.
Issue for this PR
Closes #46166
Type of change
What does this PR do?
InstanceBootstrap.runinpackages/opencode/src/project/bootstrap.tsawaitsinit()oneach per-instance service (
lsp,share,format,vcs,snapshot,project) inside anEffect.forEachwithconcurrency: "unbounded". Each init was unbounded, the previouscatchCauseonly fired on rejection, and there was no per-service log line, so a singlemisbehaving service could swallow the warning, and there was no signal at all on a hang.
This PR keeps the concurrency shape (
unbounded, all services start in parallel) and adds:Effect.timeoutaround each individualservice.init(). On timeout theservice's
initis interrupted, the rest of the bootstrap continues, and alogWarning("instance service init failed", { service, cause })is emitted.logInfostart and finish line ("instance service init started"/"instance service init completed") so the bootstrap log is navigable.logInfo("bootstrap completed", { directory })at the end so callers canconfirm the layer reached the steady state.
The 10-second budget is a deliberate trade-off: a healthy service
initis bounded bylocal state materialization and should return in well under a second; 10 seconds is large
enough not to fire on slow disks, small enough that a hung init does not block the rest
of the bootstrap indefinitely. The previous behaviour was effectively "unbounded", so
this is strictly more recoverable, never less.
How did you verify your code works?
packages/opencode/src/project/bootstrap.ts, +16/-2.bun typecheckinpackages/opencodepasses (tsgo --noEmitexit 0) afterbun installin the worktree, againstupstream/devheaddc4449df0dplus this commit.bootstrap.runis the only caller of the listed services'init()inthis layer; the new
Effect.timeoutis scoped to that oneEffect.forEachbody. Theouter
Effect.withSpan("InstanceBootstrap.init")and theEffect.withSpanonrunare unchanged, so the trace tree stays the same.
Screenshots / recordings
N/A — server-side, no UI change.
Checklist
bun typecheckinpackages/opencodepasses (tsgo --noEmitexit 0) afterbun installin the worktree, againstupstream/devheaddc4449df0dplus this commit.