Skip to content

test(stack): report owner lease and log tail when a command stream loses its owner - #7894

Open
avallete wants to merge 2 commits into
developfrom
avallete/flaky-run-command-lost-owner
Open

avallete wants to merge 2 commits into
developfrom
avallete/flaky-run-command-lost-owner

Conversation

@avallete

@avallete avallete commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

TL;DR

When a stack command loses its owner connection, the error now says whether that owner still holds the stack lease and shows its log tail, as calls already do. This covers drops both before and after the response headers.

  • apps/cli/tests/contract/contract.native-tls.integration.test.ts › consumer contract (stack/native over api.tls, project pair): catalog setup failed with Owner response unavailable … ECONNRESET (operation: 'command'), the same symptom as the open start.e2e › auth.site_url flake. The lease and owner.log tail detail only covered call, and only a TransportError before headers. runCommand mapped its stream failure without the detail, and a drop after headers surfaces as DecodeError during the body read, so a command whose owner crashed mid-run gave no clue either way. Command stream failures now go through the same lost-owner observation, and both kinds count as a lost owner. The lost-owner integration test covers a pending call, a pending command and a command streaming output.

ref

spotted in:

https://claude.ai/code/session_01MBEk1LbJ2E6dMJWE4Vhjtm


Generated by Claude Code

…ses its owner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@avallete
avallete requested a review from a team as a code owner December 1, 2026 07:44
@avallete
avallete requested a review from Prashansa-K December 1, 2026 07:44

avallete commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

/ai-review


Generated by Claude Code

@avallete avallete added the run-flaky-check Run the flaky-test check on this PR label Dec 1, 2026 — with Claude
@github-actions github-actions Bot removed the run-flaky-check Run the flaky-test check on this PR label Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

CLI benchmark (Lightweight Commands): no changes found

Commit 47e877d against develop at 00782d7 · 10 runs each · report only, never blocks merging

Command Workload Before After Change
supabase --version version 165 ms 169 ms no real change
supabase --help help 192 ms 188 ms no real change
supabase init init 179 ms 173 ms no real change
supabase migration new bench migration-new 191 ms 193 ms no real change
supabase config convert config-convert 191 ms 188 ms no real change
supabase config validate config-validate 197 ms 197 ms no real change
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 204 ms 200 ms no real change
supabase projects list projects-list 184 ms 182 ms no real change
supabase functions list --project-ref replayfixtureprojref functions-list 187 ms 191 ms no real change

API calls: unchanged for all 9 commands.

Binary size: 135.7 MB, up 4.0 KB from 135.7 MB.

Details: timing ranges, API calls per command, slowest phases

Timing ranges

Command Workload Before range After range Change Verdict
supabase --version version 157-185 ms 164-198 ms +4 ms (+3%) within noise
supabase --help help 165-208 ms 159-247 ms -4 ms (-2%) within noise
supabase init init 164-205 ms 166-188 ms -6 ms (-3%) within noise
supabase migration new bench migration-new 177-233 ms 175-243 ms +2 ms (+1%) within noise
supabase config convert config-convert 188-209 ms 179-199 ms -3 ms (-1%) within noise
supabase config validate config-validate 184-219 ms 186-245 ms +0 ms (+0%) within noise
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 194-229 ms 192-235 ms -4 ms (-2%) within noise
supabase projects list projects-list 178-200 ms 178-200 ms -2 ms (-1%) within noise
supabase functions list --project-ref replayfixtureprojref functions-list 182-227 ms 184-206 ms +3 ms (+2%) within noise

API calls per command

Command Workload Before After Endpoint changes
supabase --version version 0 0
supabase --help help 0 0
supabase init init 0 0
supabase migration new bench migration-new 0 0
supabase config convert config-convert 0 0
supabase config validate config-validate 0 0
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 2 2
supabase projects list projects-list 1 1
supabase functions list --project-ref replayfixtureprojref functions-list 2 2

Slowest phases

No command moved beyond noise, so there are no phase deltas.

Workflow run

Comment /bench to run the lightweight benchmark (this comment) again on the latest commit, or /bench full to also run the integration-heavy benchmark, which posts in its own comment.

@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.

Superseded by a newer AI review

🤖 AI Review

CLI reference prose guidance: not applicable (no reference sources changed).

Both reviews identified one minor test coverage gap. The new command case verifies owner-loss diagnostics before the first stream event, leaving disconnects after streaming begins untested. The verdict is based on source inspection. CLI reference prose review was inapplicable.

Findings

Severity Location Category Sources Claim
🟡 MINOR packages/stack/src/effect.integration.test.ts:1035 test-coverage claude+codex The case named "a running command" drops the connection before the client receives any command event. It verifies the lease and log-tail diagnostic for a pending RPC and leaves the same diagnostic untested after streaming begins. The shared fiber name and early-settlement message also still describe the composition call.

Stats

Claude findings: 1 · Codex findings: 1 · Confirmed: 1 · 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.

@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

CLI reference prose guidance: not applicable (no reference sources changed).

The PR adds owner lease and log-tail diagnostics to command-stream transport failures. Both findings are confirmed. The new test covers a disconnect before the first RPC response, leaving disconnects after attachment untested. Status, log, and stdin failures retain their existing generic diagnostics. The diff changes no CLI reference prose. This was a static review because workspace dependencies were absent.

Findings

Severity Location Category Sources Claim
🟡 MINOR packages/stack/src/effect.integration.test.ts:986 test-coverage codex The case named "a running command" only exercises a disconnect while the client is waiting for the first RPC response. It leaves a disconnect after command attachment untested.
⚪ NIT packages/stack/src/effect.ts:851 error-handling claude Owner transport failures on status streams, log streams, and command stdin still omit the lease status and available owner log tail.

Stats

Claude findings: 1 · Codex findings: 1 · 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.

}),
),
Stream.mapError((cause) => failure("command", cause)),
Stream.catch((cause) =>

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.

⚪ NIT · error-handling · source: claude

Owner transport failures on status streams, log streams, and command stdin still omit the lease status and available owner log tail.

Evidence: packages/stack/src/effect.ts:851–853 passes the runCommand stream failure and its connection to ownerFailure. The shared stream helper at line 641 and both commandInput calls at lines 868 and 875 pass errors directly to failure. Line 194 appends owner detail only when supplied.

Suggested fix: For consistent diagnostics, use ownerFailure with the borrowed connection for RPC errors inside the shared stream helper and for both commandInput calls.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, the status/log streams and commandInput still map failures directly. This PR covers only the runCommand stream path, because that is where the contract-test flake failed (operation: 'command'). I am leaving the other paths to a separate change instead of widening this diagnostic PR.


Generated by Claude Code

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Flaky test check: ✅ no flaky tests

Commit 95656fd17b47 · focused ×10 (5 executions each), 9457 tests · integration ×10, 7887 tests · unit ×10, 10393 tests · workflow run

Each execution is a separate Vitest process; Where lists failing runs, as run.iteration for suites executed more than once per run. The full data is in the flaky-check-report artifact.

@jgoux jgoux 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.

The TransportError path from the cited CI run is covered: the new command case fails without the effect.ts change and passes with it. One gap remains for the main case the PR describes, a command whose owner drops while it runs. Details inline.

Comment thread packages/stack/src/effect.ts Resolved
…he response body

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MBEk1LbJ2E6dMJWE4Vhjtm
@avallete avallete added the run-flaky-check Run the flaky-test check on this PR label Dec 2, 2026 — with Claude
@avallete
avallete requested a review from jgoux December 2, 2026 09:45
@github-actions github-actions Bot removed the run-flaky-check Run the flaky-test check on this PR label Dec 2, 2026

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.

3 participants