Skip to content

fix(platform): refuse new work in a sandbox being destroyed - #4095

Merged
yannickmonney merged 9 commits into
mainfrom
fix/sandbox-destroy-retry-resumed-work
Oct 2, 2026
Merged

yannickmonney merged 9 commits into
mainfrom
fix/sandbox-destroy-retry-resumed-work

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Repair round 1: a resume could revive a row settled under it

The finding (review 5396935490, r4169908059). resumeSessionSlot read its row without a lock and wrote it back by id alone. A terminal write takes no admission lock. That covers markSessionDestroyed (from a Destroy attempt, a heal or a reclaim), the cleanup's claim and a watchdog's stamp. So a settlement could commit between the row read and sessionDestroyPending, and the predicate would find no live row. The write then moved the destroyed row back to active, and ensureAgentSession returned the old createdAt: the old conversation over a deleted workspace.

Reproduced first, deterministically, at the reviewed head e73d55aaa. I added the check in d5a4864e2:

  • An ACCESS EXCLUSIVE lock on pgboss.job holds the resume exactly between its row read and its predicate. The wait is observed in pg_locks; no sleep orders anything.
  • The settlement then commits on a connection of its own, and the lock is released.

Both variants end the same way at e73d55aaa:

FAIL  sandbox Destroy admission: a resume never revives a row settled between its read and its predicate (a Destroy attempt) — resume paused between its read and its predicate=true, settlement committed meanwhile=true, resume=admitted (want absent), row after=active (want destroyed), revived with its destroyed stamp
FAIL  sandbox Destroy admission: a resume never revives a row settled between its read and its predicate (a heal) — … resume=admitted (want absent), row after=active (want destroyed), revived with its destroyed stamp

The fix (eeaac14f1): compare-and-set on the resume write.

  • The write is now UPDATE … WHERE id = $row AND status = ANY(live) RETURNING id, and 0 rows answers false.
  • The callers already read false as an allocation that no longer exists (ensureAgentSession throws, and the task's retry opens a fresh incarnation).

The ordering guarantee is stated in the source at the write:

  • A settlement anywhere before the write leaves the write nothing to move, as if the settlement had come first.
  • A write that lands holds the row until the commit.
  • After the commit, an administrator's Destroy settles only from inside an attempt while its job is unfinished. One queued earlier either refused the turn at the predicate or had already settled the row, leaving the write nothing to move. One asked for later waits for the admission lock, so it is ordered after the turn and cancels it.

There's no new lock and no migration, and the rule and docs are unchanged. With the fix:

PASS  … (a Destroy attempt) — resume paused between its read and its predicate=true, settlement committed meanwhile=true, resume=absent (want absent), row after=destroyed (want destroyed)
PASS  … (a heal) — … resume=absent (want absent), row after=destroyed (want destroyed)

Also in this round:

Adjacent, not changed here (pre-existing on main). The task host's activation after a fresh create (sandbox/session_mutations:setSessionStatus in the agent-turn shim) also writes by row id alone. A Destroy that settles a creating row during its create can therefore be undone by that activation. It isn't a delayed retry deleting resumed work, and closing it means the host failing the start when the activation moves nothing. I suggest a follow-up.

What changed

If a sandbox Destroy is queued, retrying or running, its row no longer accepts new work.

The bug (#4091, found in the #4087 review). If the first Destroy attempt fails, the sandbox.destroy_session ladder retries for 15 to 30 minutes. Each retry checks only that the row is still the one it was asked for (teardownSession's row-id guard). A resume keeps the row id (resumeSessionSlot updates the row in place), so a turn could resume between two attempts. The next attempt then:

  • killed that turn;
  • deleted its workspace;
  • revoked its tokens and gateway keys.

The rule: a pending Destroy closes its row to admission, enforced at the hosts' one admission boundary under the organization's admission lock.

  • reserveSessionSlot() refuses the session while a live row under that id has an unfinished Destroy job.
  • resumeSessionSlot() refuses the row it would resume.
  • scheduleSessionDestroy() now takes the same lock. A turn is therefore admitted either before the request, and cancelled by the Destroy as running work always was, or after it, and refused.
  • The predicate is sessionDestroyPending() in destroy-schedule.ts. It reads the same queue row the page shows as Destroying (sessionDestroyStates), so the server rule and the badge agree by construction.

What a refused turn does. The refusal is SandboxDestroyPendingError, a subclass of SandboxQuotaError (QUOTA_EXCEEDED with its own message).

  • Task and chat runs: the run parks, as it does for a full budget, and reads the already-translated Waiting for a sandbox slot (tasks.agentRun.waitingForSlot, chat.taskTray.waitingForSlot). It wakes when the Destroy settles (markSessionDestroyed's release edge) or on the 2-minute watchdog tick, then starts in a fresh workspace.
  • Automation steps: the step fails before it begins, with the reason.
  • After the ladder runs out (failed): the row reopens, so an agent's deterministic workspace id is never locked for good.

Why this rule and not "delete only if idle". With #4088, a first attempt whose answer was lost may already have moved the tree to .trash. A turn let in between attempts would then resume the same incarnation (with its --resume handle) over a half-deleted workspace. Refusing admission also carries out the administrator's request instead of silently dropping it, and needs no migration.

Unchanged:

  • the teardown itself: row-id guard for newer incarnations, unpin before delete, settle, token and gateway-key revocation;
  • organization isolation (every read is org-scoped, and so is the lock);
  • the page's pending and failed states.

Finding → commit → test

Finding Commit Test (real Postgres unless noted)
A retry deletes a row resumed between attempts: chat, agent and automation paths through ensureAgentSession on each lane's own shim ef83dc8a0 (regression), 0ae685338 (fix) checkSandboxSpawner: sandbox Destroy retry never deletes work resumed after the request: a member's chat run / an agent's next task / an automation's next step. These use the real admin route, the real pg-boss retry and the HTTP stand-in spawner, and cover eventual success with a fresh incarnation afterwards
Lock order 1: a retry holds the lifecycle lock while deleting; a resume arrives same checkSandboxLifecycle: a resume while a retry deletes the workspace is refused before it starts
Lock order 2: an admission holds the org lock; the Destroy request arrives same a request waits for an admission in progress, and a turn after it is refused (observes the waiter in pg_locks; a fresh reserve beside the row is refused too)
Repeated Destroy; a failed ladder must reopen the row same a repeated Destroy is absorbed while pending, a failed one reopens the row, a new one closes it
Eventual success after idle same once the Destroy has deleted the workspace, the next start opens a fresh incarnation (passes on main too; it guards against over-refusal)
Newer incarnation same a Destroy pending for a settled incarnation blocks no newer one (passes on main too; it guards the row-id scoping)
Organization isolation same a Destroy holds its own organization's row only
Predicate shape and lock order of the request 0ae685338 destroy-schedule.test.ts (unit)
Knip: the refusal class was an unused export b9409324f CI Knip
The full CI run's lane org was already at its project-session cap, so the new spawner-lane check provisioned into its own synthetic organization (the route's scheduler, the page's reader, the real worker and the stand-in spawner) e73d55aaa CI Backend integration, all lanes
Round 1: a settlement between the resume's read and its predicate revived the row d5a4864e2 (regression), eeaac14f1 (fix) checkSandboxLifecycle: a resume never revives a row settled between its read and its predicate (a Destroy attempt) / (a heal)
Round 1: manual overview total adf8c4640 lint:manual; the overview equals the sum of the suite table (1082)
Round 1: integrate main b7d1c1d7e aef578832 the gates below at the merged head
Docs said a start during Destroying "still works in the old files" aedeb4f80 EN/DE/FR platform/admin/sandboxes.md; manual box SET-B30; automation-register row

How I verified it

Real Postgres: PostgreSQL 16.14 with pgvector 0.8.6, from the PGDG bookworm debs, checksums recorded. There is no pg_search. Each run used a fresh database pair:

cd services/platform
DATABASE_URL=postgres://tale:…@127.0.0.1:55476/tale_app_<run> \
KNOWLEDGE_DATABASE_URL=postgres://tale:…@127.0.0.1:55476/tale_knowledge_<run> \
TALE_CONFIG_DIR=<fresh> TALE_CONFIG_BUILTIN_DIR=<fresh> \
ITEST_LANES=checkSandboxLifecycle,checkSandboxSpawner bun run backend:integration
Tree Result
main 19776cf18, untouched 28/30
main code + the final regressions 30/39: the 7 new checks fail, for example start between attempts=resumed (want refused), container after it=running, row=active, page=pending, …, container after the retry=none, turn tokens revoked=1/1
head e73d55aaa 37/39: every new check passes, for example start between attempts=refused, container after it=none, row=stopped, page=pending, retry settled=true, turn tokens revoked=0/0, start after the Destroy=fresh
Round 1: d5a4864e2 (e73d55aaa's code + the interleaving regression), lane checkSandboxLifecycle 30/33: both new interleaving checks fail (resume=admitted … row after=active … revived with its destroyed stamp)
Round 1: eeaac14f1 (the fix) 39/41: every new check passes (resume=absent … row after=destroyed)
Round 1: head adf8c4640 (fix merged with main b7d1c1d7e) 39/41: all 11 new Destroy checks pass

Locally, the same two checks fail in every run, and both are environmental:

  • knowledge BM25 indexes verified at boot needs pg_search;
  • workspace-tool door … product_find=ok (hit=false) also fails on the untouched main run.

CI's tale-db image has pg_search.

CI on head e73d55aaa: Backend integration is 1440/1440 checks across 217/217 lanes, including all 9 new checks (run 37058930318, job 111010513842). Knip, Type check, Unit and the rest of Checks are green. The first round at b9409324f truncated at checkSandboxSpawner: the lane org's project-session cap, fixed in e73d55aaa.

CI on head adf8c4640: Backend integration is 1447/1447 checks across 217/217 lanes (run 37072554375, job 111055188406). That includes both interleaving checks (resume paused between its read and its predicate=true … resume=absent … row after=destroyed) and the 9 earlier ones. Every workflow succeeded: Checks 37072554375, Build 37072554384, E2E 37072554430, SAST 37072554519 and Commitlint 37072554459. The skipped checks are fork-PR jobs, containers this change doesn't touch, and the candidate gates.

Other local checks (repeated at the round-1 head):

  • Unit tests: destroy-schedule.test.ts 9/9. The 62 sandbox, session-client, shim, task-host and jobs test files: 966/966. I left out render_fetch.test.ts, which fails 15/30 identically on unmodified main because there's no browser here.
  • Lint and format: oxlint --type-aware exits 0 on the changed files, and oxfmt --check is clean.
  • Types: tsc --noEmit over the changed files plus integration-check.ts in an isolated config: 0 errors, 3,255 files.
  • Guards: integration-scope and integration-skips 9/9.
  • Docs: locale-translation, locale-outline, structure-prose, locale-components and links tests 11/11.
  • Manual: lint:manual ok (1427 boxes across 5 trees), and check-guide.ts settings.md OK.
  • Knip: bun run knip:check clean.

Not in this change

  • TALE-475 (bug(sandbox): erasure succeeds before trash bytes are deleted #4090): the erasure acknowledgement is separate.
  • The review's LOW items, still open:
    • a slot queue or batch cap for sandbox.destroy_session;
    • the handler ignoring signal, so an attempt that runs past its 900 s expiry can overlap its retry. If pg-boss marks that expired attempt failed while it still runs, admission reopens under it. I didn't verify this at runtime;
    • the 7-day job retention dropping the visible Destroy failed.
  • A run label that names the Destroy rather than "Waiting for a sandbox slot": this would need a contract field.
  • Message wrapping: an automation step's failure text shows the refusal wrapped as AppError JSON. That's how every QUOTA_EXCEEDED reads there today.
  • No migration, no new UI string and no new error code. QUOTA_EXCEEDED is reused, and no secret reaches a message or log.

Closes #4091

A sandbox Destroy whose first attempt fails retries for a quarter to half
an hour, and its retry checks only that the row is still the one it was
asked for. A resume keeps the row id, so a turn let in between two
attempts loses its container, workspace and tokens to the next one.

The spawner lane drives the real Destroy job through the admin route and
the HTTP stand-in spawner: the first attempt fails, then a member's chat
run, an agent's next task and an automation step ask for the row through
their own shims (ensureAgentSession), then the retry runs. The lifecycle
lane holds a pending Destroy against both lock orders, a repeated and a
failed Destroy, eventual success, a newer incarnation and another
organization's row under the same id.

Refs #4091
A Destroy that is queued, retrying or running now closes its row to new
work. The hosts' one admission refuses the session under the
organization's admission lock: reserveSessionSlot while a live row under
the id has an unfinished sandbox.destroy_session job, resumeSessionSlot
for the row it would resume. scheduleSessionDestroy takes the same lock,
so a turn is admitted either before the request (and cancelled by the
Destroy, as running work always was) or after it, and refused.

The refusal is quota-shaped (SandboxDestroyPendingError extends
SandboxQuotaError): a task's run parks as on a full budget and is woken
when the Destroy settles or by the watchdog, then starts in a fresh
workspace; an automation step fails with the reason before it begins. A
Destroy whose every attempt failed reopens the row, so a deterministic
workspace id is never locked for good. The pending state is the same
queue row the page reads as Destroying, so the rule and the badge agree;
the teardown, its row-id guard and its unpin, settle and key cleanup are
unchanged, and no migration is needed.

Closes #4091
The Sandboxes page's Destroy row said an agent that starts while the row
reads Destroying still works in the old files until the deletion cancels
it. It now says nothing new starts there: an agent's run waits, reading
Waiting for a sandbox slot, and a workflow run's step fails with the
reason; once the row is gone the next start gets a fresh environment, and
if the Destroy fails the waiting work continues in the old files. EN, DE
and FR. SET-B30 is the manual box; the automation register names the
checks that own the logic half.

Refs #4091
Knip reads SandboxDestroyPendingError as an unused export: only the
admission verbs in sessions.ts throw it, and every caller sees it as the
quota refusal it extends.

Refs #4091
In the full Backend integration run the lane's organization already holds
as many project sandbox sessions as its budget allows, so provisioning the
chat and task workspaces threw the cap's SandboxQuotaError and truncated
the run at checkSandboxSpawner. The three paths now work in a synthetic
organization: the Destroy is asked for through the route's own scheduler
and read back through the page's reader, the real worker still runs it
against the stand-in spawner, and the rows and jobs go afterwards.

Refs #4091

@yannickmonney yannickmonney left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review verdict: changes requested. Reviewed by a separate agent and cross-checked by the coordinating reviewer; submitted as a comment because this repository shares one GitHub principal with the author. No GitHub approval is asserted.

Request changes on the source-derived terminal-settlement/resume gap described inline. No local concurrency or teardown test was run. Exact-head hosted Backend integration is 1,440/1,440 across 217 lanes; all 18 Playwright jobs succeeded, and their annotations/artifact listing show no retry/failure diagnostics. Also correct the manual overview total: 1,079 boxes are present, while the readme still says 1,078. This review does not claim the ordering concern was reproduced.

Review 5396935490 (r4169908059) found that resumeSessionSlot reads its
row without a lock and writes it back by id alone, while a terminal write
takes no admission lock. A settlement that commits between the read and
the pending-Destroy predicate leaves the predicate no live row to find,
and the write then moves the destroyed row back to active.

The lifecycle lane now pauses the resume exactly there, deterministically:
an ACCESS EXCLUSIVE lock on the queue's table holds the predicate after
the row read (the wait is observed in pg_locks), the settlement commits on
a connection of its own, then the lock is released. At e73d55a both a
Destroy attempt's settlement and a heal end with the resume admitted and
the row active again, its destroyed stamp kept.

Refs #4091
resumeSessionSlot read its row without a lock and wrote it back by id
alone, while a terminal write (markSessionDestroyed from a Destroy
attempt, a heal or a reclaim; the cleanup's claim; a watchdog's stamp)
takes no admission lock. A settlement committing between the read and the
pending-Destroy predicate left the predicate no live row to find, and the
write moved the destroyed row back to active: the caller resumed the old
incarnation, its createdAt and conversation, over a deleted workspace.

The write is now the boundary: it moves the row only while it is still
live and answers false when it moved nothing, as if the settlement had
come first; the caller already reads false as an allocation that no
longer exists, and its next start opens a fresh incarnation. A write that
lands holds the row until the commit; after it, an administrator's
Destroy settles only from inside an attempt while its job is unfinished,
so one queued earlier refused the turn at the predicate or had settled the
row already, and one asked for later waits for the admission lock and
cancels the turn. The source states this ordering at the write.

Refs #4091
The platform manual's overview said 1078 boxes while 1079 were present
at e73d55a (SET-B30 was counted in its suite but not in the total); with
main's three new boxes it now reads 1082, the sum of its own table. The
automation register names the new interleaving check: a resume moves its
row only while it is still live.

Refs #4091

@yannickmonney yannickmonney left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Source re-review of the P1 at adf8c4640522bafbbf91979cbf02af837c2790a9: the new live-status compare-and-set on the resume UPDATE addresses the ordering gap in my previous review. A terminal settlement committed before the write now makes it update zero rows and return false; a successful write holds the row through commit. This avoids reviving the already-settled incarnation. The surrounding explanation correctly distinguishes a prior unfinished Destroy from a later request serialized by the admission lock.

This is a bounded source disposition for the original P1, not whole-PR merge acceptance. I read the changed lifecycle regression source but ran no new interleaving experiment. Preserve the author's local environment limitations and verify the full native/CI and current-main composition evidence through the independent review owner (Tale agent #2). No skipped or pending job is counted as success, and the release hold remains until that acceptance and merge are observed.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Independent review of PR #4095 at adf8c4640522bafbbf91979cbf02af837c2790a9: accepted. Root's P1 is fixed, and the CAS carries it. One MEDIUM is pre-existing (it is on main too) and goes to a follow-up.

  • Reviewer: Tale agent update dashboard ui (#508) #2 3f9fdcee-79e7-430b-a430-ba179d5b5132, TALE-359 run e32191b4-f2e1-4096-b5cc-419e9ad8ce51.
  • Implementation: agent optimize rag action #4 5f5307c9, runs 97a46e89 and repair d35a7bb8. They are distinct from this run.
  • Scope:
    • root's P1 (review 5396935490, r4169908059);
    • the whole terminal-settlement ordering argument;
    • the merge into current main 8e10d9cb4.
  • Method:
    • my own reading of the round-1 diff, plus one read-only review agent;
    • real-Postgres runs of the lifecycle lane in my own checkout: the head, four one-change mutants, and one probe.

Local evidence. PostgreSQL 16.14 with pgvector and no pg_search, a fresh database pair per run, ITEST_LANES=checkSandboxLifecycle:

Tree Result
head adf8c4640 32/33. The one failure is knowledge BM25 indexes verified at boot, which needs pg_search. All 8 sandbox Destroy admission checks pass.
M1: the resume's compare-and-set without AND status = ANY(live) 30/33. Both interleaving checks fail with resume=admitted (want absent), row after=active (want destroyed), revived with its destroyed stamp: root's P1, with only this hunk removed.
M2: the condition kept, moved.length ignored 30/33. The same two fail: resume=admitted, row after=destroyed.
M3: scheduleSessionDestroy without lockOrgAdmission 31/33. request waited for the admission lock=false.
M4: the resume without sessionDestroyPending 26/33. Six admission checks fail.
  • Unit tests: 28 files and 370 tests in backend/domains/sandbox and backend/jobs pass.
  • CI at the exact head: 51 success, 10 skipped by design (candidate gates, fork-PR jobs, untouched containers) and Trivy neutral. Backend integration ran 1447/1447 across 217/217 lanes (job 111055188406), on merge 1db0852 of this head into b7d1c1d7e.
  • Merge with main 8e10d9cb4:

The ordering argument holds for the row a Destroy names. I checked:

  • Lock scope and key. The admission lock is transaction-scoped, with one key everywhere (admission-lock.ts). The resume holds it from its row read through the predicate, the cap check and the compare-and-set to its commit.
  • The Destroy's job is inserted inside the transaction that holds the lock (addJobInTx).
  • The predicate's states (created, retry, active) are pg-boss 12.28's unfinished set. They match its exclusive singleton index.
  • Under a settle that waits on its row lock, the compare-and-set is re-evaluated, and false makes ensureAgentSession throw before it acquires compute or mints anything (agent_session.ts:98-103).
  • Locks are only ever taken lifecycle → admission, so there is no deadlock.
  • A closure is bounded: failed reopens the row, and a crashed attempt clears at the 900 s expiry.

MEDIUM (pre-existing on main, reproduced at this head): a fresh incarnation reserved while an attempt deletes is settled by that attempt.

Three facts combine:

  • The predicate closes a session only while the named row is live (destroy-schedule.ts:118-119).
  • The teardown checks the row id once, at its start (service.ts:133-138).
  • Its final markSessionDestroyed is session-wide: it settles every non-destroyed row under the id, and every token (sessions.ts:481-492).

Two writers take the named row out of the live set without either lock:

  • the host's by-id failed after a failed create (agent_session.ts:157-160 → agent-turn-shim.ts:759-771);
  • the watchdog's expiry (watchdogs.ts:184-200).

If either happens while an attempt deletes, a reserve under the same id is admitted, and the attempt then destroys it.

Probe. I inserted it untracked into checkDestroyAdmission, with the attempt gated in its delete like check 1, and removed it afterwards:

Named row during the attempt Fresh reserve Predicate Rows after (oldest first)
stays stopped (control) refused true destroyed
set failed by id admitted false destroyed,destroyed
set expired admitted false destroyed,destroyed

The real path (from source; the timing is not measured):

  1. A Destroy lands while a turn's create is in flight.
  2. The delete kills that create, and the host sets the row failed.
  3. The run's immediate auto-retry reserves a fresh row.
  4. The attempt's settle destroys that row and revokes its tokens.
  5. The shim's by-id activation (below) can then bring it back active with a destroyed stamp.

On main this happens without any predicate, so it is not a regression. It does mean #4091's "a newer incarnation" criterion holds only between attempts. The CAS comment ("one queued before … either refused the turn at the predicate or had settled the row already") overclaims for this case.

Fix options:

  • settle only the named row in the teardown, as the workspace cleanup does (workspace-cleanup.ts:253-258); tokens are keyed by session id, so they need the same scoping;
  • or let an active Destroy job close the session id whatever its row's status.

LOW and INFO

  • LOW, the known LOW update dashboard ui (#508) #2. An attempt that outlives the 900 s expiry of the last try is re-inserted as failed while its handler runs (pg-boss 12.28 failJobsByTimeout).
    • Admission then reopens under a live attempt. The CAS neither helps nor hurts.
    • The comment's "while its job is unfinished" overclaims this case too.
    • Fix: pass signal into the teardown, and check it before the delete and before the settle.
  • INFO, pre-existing, you named it. The shim's id-only activation (agent-turn-shim.ts:759-771) can revive a settled row. Fix: AND status = 'creating', and fail the start when nothing moves.
  • INFO, the comment at sessions.ts:427-433 misdescribes two writers:
    • a heal settles under the lifecycle lock (service.ts:331-337), not under none;
    • the cleanup's claim takes the admission lock (workspace-cleanup.ts:270-271).
    • Harmless: the CAS holds whatever the writer.
  • INFO, the new check's lock. LOCK TABLE pgboss.job IN ACCESS EXCLUSIVE MODE stalls every queue for the hold, with no lock_timeout, and its probe matches any relation.
    • It is safe today: lanes run serially, the org is synthetic, and the lock is released in finally.
    • Suggest SET LOCAL lock_timeout and relation = 'pgboss.job'::regclass.
  • INFO, pre-existing:
    • A heal between attempts makes the next attempt exit at the row-id guard without retrying the delete, so the request is dropped silently.
    • markSessionDestroyed revokes tokens by session_id without org_id. This is theoretical, because ids embed UUIDs.
  • Composition. If fix(platform): wait for sandbox room instead of failing the run #4099 also merges, this refusal becomes an automation room wait: capacity_refusal.ts reads any QUOTA_EXCEEDED as organization room. That contradicts this PR's docs, and it is fix(platform): wait for sandbox room instead of failing the run #4099's to resolve. My fix(platform): wait for sandbox room instead of failing the run #4099 review covers it.

Verdict: accepted for #4091's resumed-work path and root's P1. The MEDIUM goes to a follow-up issue through the manager. No browser pass: the UI strings are unchanged and the docs were read in EN, DE and FR.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Whole-PR acceptance addendum for #4095, answering root's review 5397655922 (01:20 Zurich). Tale agent #2 3f9fdcee, TALE-359 run bf6088f7-61a5-4c81-81c2-60ecc309e34e. This supplements my acceptance record 5962968090 of adf8c4640522bafbbf91979cbf02af837c2790a9, which I merged as 358f69107 at 23:17:53Z.

I read everything below from the GitHub API and the job logs myself; none of it is taken from the author's report.

Exact-head coverage

Workflow (pull_request) Run Attempt Result
Checks 37072554375 1, every job attempt 1 success
Build 37072554384 1 success
E2E 37072554430 1 success
SAST 37072554519 1 success
Commitlint 37072554459 1 success
  • Workflows that never ran, and are not counted as passed:
    • CLI: its PR path filter (tools/cli/**, services/platform/lib/**, connector configs, bun.lock, …) matches none of the 13 changed files.
    • Security (the Trivy and bun audit gate): its path filter (lockfiles, manifests, Dockerfiles, .trivyignore.yaml) matches none of them either.
    • Scorecard, Release, Publish packages and Issue labeler don't run on pull requests.
  • Check runs: 62 at the head.
    • 51 succeeded.
    • 10 were skipped:
      • by design: Candidate gate ×5, Smoke test (fork PR), Validate images (fork PR);
      • by path filter: the AI gateway, UI docs and Web container tests.
    • 1 was neutral: Trivy code scanning.
  • Backend integration (job 111055188406, tested on merge 1db0852, this head into b7d1c1d7e):
    • 1447/1447 checks across 217/217 lanes, unfiltered: 1447 PASS lines and no FAIL.
    • The only retries in the log are the app's own serializable-transaction retries: 103 in all, 100 at attempt 1/5 and 3 at 2/5, none exhausted.
    • No check or lane was re-run.
    • The author's 1447/1447 matches this log.
  • E2E:
    • The 16 platform shards ran 66 passed and 1 skipped. The skip is search.spec.ts's test.fixme, in place since feat(platform): put chats, tasks and the inbox in one Home panel #3492.
    • Docs ran 43 passed, and web 36 passed.
    • None of the 18 job logs has a retry or flaky line.
    • The only annotations are the runner-image notice, plus a Node 20 deprecation warning on Format.
  • One failure-level annotation inside a green job. In Build platform, the Turbo remote-cache action's post-cleanup logs "There is nothing to upload" and then Input required and not supplied: server-token.
    • The action's outcome is success.
    • The image was built, validated and smoke-tested.
    • This is tooling noise, not a hidden red.
  • Local evidence, kept apart:
    • Mine: the lifecycle lane, 32/33 on PG16 without pg_search, where the one failure is the BM25 boot check; four one-change mutants; and one probe, run while an attempt was mid-delete.
    • The author's 39/41 includes checkSandboxSpawner, which I did not run locally.
    • CI ran both lanes.

Composition with current main

Follow-ups: dispositions, not waivers. All three pre-existing items are deduplicated into #4106, and none comes from this PR.

Item Source triage Remaining risk
A fresh incarnation is settled mid-attempt MEDIUM, reproduced at this head by my probe. It is on main without this PR and predates #4087, because the in-request teardown had the same session-wide settle. A turn reserved under the same session id while an attempt deletes can have its row destroyed and its tokens revoked. The window runs from a create failing under the delete to the attempt's settle.
LOW #2: expiry overlap Verified from pg-boss 12.28's source (failJobsByTimeout re-inserts the last try as failed). The CAS neither helps nor hurts. An attempt has to outlive 900 s. Only the wait for the lifecycle lock is unbounded; spawner calls time out at 30 s.
The shim's id-only activation after a fresh create INFO, pre-existing, and unchanged by this PR. A Destroy that settles a creating row during its create can be undone, reviving the row with a destroyed stamp. The host's relaunch on a dead resume handle limits the damage.

So whole-PR acceptance at adf8c4640 stands, and the merge is observed. The deployment decision stays with root.

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.

bug(sandbox): a delayed Destroy retry deletes resumed work

1 participant