Repository navigation
Conversation
The `start --attach` stream can drop the helper's ready line while the helper keeps running, so startup waited out the 30s readiness timeout. Readiness now also follows the helper's log and takes whichever source reports it first; the readiness span records which one did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MBEk1P9Wa6uFrNKhW7kMB8
|
/ai-review Generated by Claude Code |
CLI benchmark (Lightweight Commands): no changes foundCommit
API calls: unchanged for all 9 commands. Binary size: 135.1 MB, unchanged. Details: timing ranges, API calls per command, slowest phasesTiming ranges
API calls per command
Slowest phasesNo command moved beyond noise, so there are no phase deltas. Comment |
There was a problem hiding this comment.
Superseded by a newer AI review
🤖 AI Review
CLI reference prose guidance: not applicable (no reference sources changed).
Both reviews identified a startup ordering bug that can leave the new log fallback idle until the 30-second timeout. A separate finding confirms that attach EOF or a stream error can cancel the fallback before it reports readiness. The new test covers a silent attach stream paired with an immediate log marker. Verification was static because the local Docker socket denied access. The diff contains no CLI reference prose changes.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟠 MAJOR | packages/stack/src/storage/DockerDatabaseStorage.ts:712 |
startup-race |
claude+codex | If Docker handles the single log-follow request before the helper starts, the follower can exit empty. If the attach stream also misses the readiness marker, the storage operation fails after 30 seconds even though the helper became ready. |
| 🟠 MAJOR | packages/stack/src/storage/DockerDatabaseStorage.ts:729 |
correctness |
codex | If attach stdout closes, errors, or produces a different first line while the helper is still running, it can cancel the log fallback before the readiness marker arrives and cause startup to fail. |
Stats
Claude findings: 1 · Codex findings: 2 · Confirmed: 2 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
| ), | ||
| Effect.catch(() => Effect.never), | ||
| ); | ||
| return yield* Effect.raceFirst(attachedLine, loggedReady).pipe( |
There was a problem hiding this comment.
🟠 MAJOR · correctness · source: codex
If attach stdout closes, errors, or produces a different first line while the helper is still running, it can cancel the log fallback before the readiness marker arrives and cause startup to fail.
Evidence: DockerDatabaseStorage.ts:699–706 reads the first attach line and uses Effect.tap only to annotate a matching marker. At line 729, Effect.raceFirst accepts the first completion. Lines 732–745 check for the marker after the race and kill the attached child on failure. DockerDatabaseStorage.integration.test.ts:608–613 keeps the attach stream open indefinitely, so the test cannot exercise an early attach completion.
Suggested fix: Keep the log fallback active when attach stdout ends or errors without a marker. Preserve prompt failure when Docker confirms the helper exited, and add a test where attach reaches EOF before the log marker arrives.
There was a problem hiding this comment.
Keeping the current behavior. The helper is create --rm -i, so the attach owns its lifetime: when the attach ends or errors, Docker removes the helper, and failing fast with the attach's stderr is the intended outcome. If the log fallback kept waiting, a real exit would turn into a 30s timeout with worse diagnostics. The flake this PR targets is an attach that stays open but never delivers the line, and that is what the fallback covers.
Generated by Claude Code
There was a problem hiding this comment.
🤖 AI Review
CLI reference prose guidance: not applicable (no reference sources changed).
The Docker database helper can still miss readiness in two ways. Attach EOF or a read error can cancel the log follower before it sees the marker, and a log request that reaches Docker before startup can finish without following. The tests cover a successful log fallback and a silent follower, but do not force a failed or empty follower to finish before attach reports readiness. Verification was static because the Docker socket denied access.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟠 MAJOR | packages/stack/src/storage/DockerDatabaseStorage.ts:729 |
correctness |
codex | Attach EOF or a read error can end the readiness check and cancel the log follower before it reports that the helper is ready. |
| 🟡 MINOR | packages/stack/src/storage/DockerDatabaseStorage.ts:715 |
startup-race |
claude+codex | The one-shot log follower can finish before Docker starts the helper, leaving the existing 30-second timeout in place if attach also misses the readiness marker. |
| ⚪ NIT | packages/stack/src/storage/DockerDatabaseStorage.integration.test.ts:608 |
test-coverage |
claude | The tests do not force a follower spawn failure, EOF, or non-marker result to occur before attach delivers the readiness marker. |
Stats
Claude findings: 2 · Codex findings: 2 · Confirmed: 3 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: manual · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
| ), | ||
| Effect.catch(() => Effect.never), | ||
| ); | ||
| return yield* Effect.raceFirst(attachedLine, loggedReady).pipe( |
There was a problem hiding this comment.
🟠 MAJOR · correctness · source: codex
Attach EOF or a read error can end the readiness check and cancel the log follower before it reports that the helper is ready.
Evidence: DockerDatabaseStorage.ts:699-707 lets attach EOF complete with None and propagates read errors. At line 729, Effect.raceFirst accepts that completion and interrupts the follower. Lines 732-745 then enter failure cleanup. DockerDatabaseStorage.integration.test.ts:608-612 keeps attach pending with Stream.never, so it cannot exercise either early completion.
Suggested fix: Keep the log follower active after attach EOF or a read error while the helper can still become ready. Handle confirmed helper exit separately, preserve the deadline and diagnostics, and test a log marker that arrives after attach EOF.
There was a problem hiding this comment.
Keeping the current behavior. The helper is create --rm -i, so the attach owns its lifetime: when the attach ends or errors, Docker removes the helper, and failing fast with the attach's stderr is the intended outcome. If the log fallback kept waiting, a real exit would turn into a 30s timeout with worse diagnostics. The flake this PR targets is an attach that stays open but never delivers the line, and that is what the fallback covers.
Generated by Claude Code
| stdout: | ||
| args[0] === "start" | ||
| ? Stream.never | ||
| : following | ||
| ? Stream.succeed(new TextEncoder().encode("supabase-helper-ready\n")) | ||
| : Stream.empty, |
There was a problem hiding this comment.
⚪ NIT · test-coverage · source: claude
The tests do not force a follower spawn failure, EOF, or non-marker result to occur before attach delivers the readiness marker.
Evidence: DockerDatabaseStorage.integration.test.ts:608-613 makes the follower emit the marker immediately, and lines 504-512 keep it pending in the timeout test. The existing fake engine at lines 143-164 can return empty stdout for logs, but attach emits its marker immediately and the mirror-image test at lines 789-797 does not control the order.
Suggested fix: Use a controlled mock that completes the follower with EOF or a spawn error before releasing the attach marker, then assert that the storage operation succeeds.
There was a problem hiding this comment.
The opposite ordering (log follower fails or is empty, then attach delivers the marker) is what every other fake-engine test in this file now runs through: their fake fails inspect --format {{.Created}} / logs, the fallback stays silent, and readiness comes from attach. A dedicated test would duplicate that.
Generated by Claude Code
`logs --follow` on a container that has not started yet returns at once without following, so the readiness fallback could stay silent. The fallback now waits for the helper's start event, replayed with `--since` its creation time, before following its log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MBEk1P9Wa6uFrNKhW7kMB8
|
Re AI review:
Generated by Claude Code |
Flaky test check: ✅ no flaky testsCommit Each execution is a separate Vitest process; |
Coly010
left a comment
There was a problem hiding this comment.
approved with a few comments, none of them blocking so feel free to push back on any of them
Podman prints `{{.Created}}` in Go's default time format, which its
`events --since` does not accept, so the log fallback only applied to
Docker. Both formats now normalize to Unix seconds, which both engines
accept. Also tightens the fallback comment and test assertions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MBEk1P9Wa6uFrNKhW7kMB8
TL;DR
Database helper startup no longer depends only on the
start --attachstream to see the helper's ready line.DockerDatabaseStorage.integration.test.ts › recovers after its shared helper is removed externally: the re-created helper printedsupabase-helper-ready(it is indocker logsand the helper stays running), but the attach stream never delivered it, so startup timed out after 30s. Readiness now races the attach stream withlogs --followon the helper and takes the first source that reports ready; a failed or silent log follower never wins, and the readiness span recordshelper.ready_source. A new test covers an attach stream that drops the ready line.ref
spotted in: https://github.com/supabase/cli/actions/runs/46883655541/job/143469003518
Generated by Claude Code