Skip to content

chore: red proof for #9144 — do not merge - #9147

Closed
waleedlatif1 wants to merge 6 commits into
stagingfrom
proof/red-9144
Closed

waleedlatif1 wants to merge 6 commits into
stagingfrom
proof/red-9144

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Throwaway: #9144 with its production guards reverted, tests kept, to prove scope-deleted.integration.ts fails without the fix. Will be closed and deleted.

Deleting an account hard-deletes its solely-owned workspaces, and the cascade
takes each in-flight run's workflow and execution log with it. A run caught in
that window kept executing, then failed every terminal write: completion threw
"Workflow log not found", the cost-only fallback failed the same way, run
counts threw and logged twice, pause persistence logged errors, and the
admission reservation leaked until its TTL. A run whose log insert failed on
the deleted workspace kept executing blocks with no log row, so nothing could
record or stop it. Along the way a file upload failure surfaced raw Drizzle SQL
and bound parameters (user id, workspace id, storage key) in a block error.

- ExecutionScopeDeletedError (no cause) marks the outcome; classifyFailure
  attributes it to the owner, so it logs at info.
- completeWorkflowExecution, when the log row is missing, checks the run's
  workspace by primary key (inside the completion transaction when the row
  vanished mid-completion) and throws the typed error before any redaction,
  storage, or billing work. A missing row under a live workspace still throws
  "Workflow log not found" as before.
- LoggingSession recognizes it in every completion path: info instead of
  error, no cost-only fallback, admission slot released, later completions
  and force-fails become no-ops, and getDeletedScope() reports it.
- A log start that fails on a foreign key checks whether the workspace or
  workflow still exists; if not, safeStart returns false without the
  fallback, releases the slot, and executeWorkflowCore stops before building
  the executor. Any other start failure behaves exactly as before.
- Run counts skip a deleted scope, and a zero-row update is an info no-op.
- Pause persistence returns quietly for a deleted scope.
- User-visible error text never carries a query failure's SQL: the execution
  upload wrapper keeps its cause and redacts its message, the block executor
  redacts any query failure in the cause chain, and the workspace file,
  file-output, video, image, TTS, ElevenLabs, LaTeX, and pause sites use a
  shared getUserFacingErrorMessage.
- Rename the integration suite to scope-deleted.integration.ts so its name
  does not repeat its folder (check:file-names).
- Type the new execution-core tests through ExecutionSnapshot and
  LoggingSession instead of `as any` (check:explicit-any).
- Define FOREIGN_KEY_VIOLATION once in database-query-error and import it in
  the logger and the logging session.
- Cover the guards the first commit left untested: a minimal fallback start
  that hits the deleted scope's foreign key, a cost-only fallback that is the
  first to find the workspace deleted, and pause persistence skipping a run
  whose deletion its paused completion found.
- Give the csv-workflow-execution live test's LoggingSession stub the new
  getDeletedScope method.

Correction to the previous commit message: pause persistence is quiet only
when the paused completion itself found the workspace or workflow deleted. A
deletion that lands after the paused log was written still fails
persistPauseResult, which logs at error and force-fails the run, exactly as
before. The TSDoc now says so.
…ed workspaces

- The file-output wrapper in FileToolProcessor keeps the original failure as
  its cause, so diagnostics and the tool boundary still see a database
  failure underneath the redacted message.
- recordExecutionUsage logs a missing workflow at info, not error, when the
  run's whole workspace is gone. The completion then reports the deleted run.
  The lookup runs only on that missing-workflow branch, both branches record
  nothing as before, and a failed lookup or a live workspace keeps the error.
Fold the deleted-scope note and slot release into one session helper, reuse
the admission-slot release on the normal completion path, share an
ExecutionScope type, drop the unread executionId field and a redundant guard.
@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 16, 2026 10:59pm UTC

Request Review

@waleedlatif1
waleedlatif1 deleted the proof/red-9144 branch October 16, 2026 23:06

This branch was previously deployed

1 inactive deployment
Preview — 561be5bf Deployed Oct 16, 2026 by vercel[bot]
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