fix(stack): keep an attached owner running when start fails by jgoux · Pull Request #7061 · supabase/cli · GitHub
Skip to content

fix(stack): keep an attached owner running when start fails - #7061

Open
jgoux wants to merge 2 commits into
developfrom
fix/stack-start-attached-owner-cleanup
Open

jgoux wants to merge 2 commits into
developfrom
fix/stack-start-attached-owner-cleanup

Conversation

@jgoux

@jgoux jgoux commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When supabase start with [experimental] stack fails after acquiring the stack, the cleanup finalizer stopped the owner if the target had no running owner when it was resolved. That snapshot is taken before open, so two concurrent starts can both see no owner. One launches it, the other attaches to it. If the attaching start then fails, for example because it rejects a service still in starting, it stops the shared owner and interrupts the start that launched it.

The cleanup decision now uses ownership instead of the snapshot:

  • launchHost reports whether it spawned the owner it reached (launched), or attached to an owner that was already live or won the lease.
  • The Stack handle exposes this as launchedOwner, set by create and open with startOwner.
  • Start failure cleanup stops the owner only when this invocation launched it.
  • Ownership is decided at open time. If an attaching start later relaunches an owner that exited and then fails, that owner stays running; supabase stack stop --stack-id <id> stops it, as documented in SIDE_EFFECTS.md.
  • An integration test opens a real owner from one stackStart, has a second stackStart attach to it and fail, then asserts the first completes and the owner stays live.
  • The real-owner Docker-unreachable start tests now get the same explicit timeout as the other real-owner tests, since they could exceed the 5 s default under parallel load.

A failed experimental stack start stopped the owner whenever the target had no
live owner before open. When two starts raced, the one that attached to the
other's owner stopped it on failure. Stack handles now report whether opening
them launched the owner, and start cleanup stops only an owner it launched.
@jgoux
jgoux requested a review from a team as a code owner October 8, 2026 11:47
@jgoux jgoux self-assigned this Oct 8, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 AI Review

Both independent reviews were available. Code inspection confirms both Claude findings: a minor cleanup gap after lazy owner relaunch and a nit in the concurrency test's completion barrier. Codex reported no findings. Tests were not run.

Findings

Severity Location Category Sources Claim
🟡 MINOR packages/stack/src/effect.ts:787 correctness claude A handle that initially attaches to an owner can later launch a replacement during startup, but launchedOwner remains false. If startup then fails, the start handler skips stopping the owner this invocation launched.
⚪ NIT apps/cli/src/commands/experimental/stack/start/start.integration.test.ts:2032 test-coverage claude If the attaching run unexpectedly succeeds, the launching run remains blocked on attachedExited and the test times out instead of reaching its result assertions.

Stats

Claude findings: 2 · Codex findings: 0 · Confirmed: 2 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread packages/stack/src/effect.ts
Comment thread apps/cli/src/commands/experimental/stack/start/start.integration.test.ts Outdated
…eanup

The concurrent start test now opens the launcher before the attacher and
releases the launcher once the attacher exits with any outcome. Start
side effects document that ownership is decided at open, and how to stop
an owner relaunched by a failed start.

This branch has not been deployed

No deployments
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.

1 participant