Skip to content

fix(platform): report refused sandbox cancellations - #4263

Merged
yannickmonney merged 3 commits into
mainfrom
fix/sandbox-cancel-result
Oct 13, 2026
Merged

yannickmonney merged 3 commits into
mainfrom
fix/sandbox-cancel-result

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Stop task previously reported success when the sandbox spawner refused cancellation. The route now returns separate confirmed/refused counts; any refusal, including a partial stop, raises one destructive notification with the refusal count in EN/DE/FR. Confirmed successes retain the declared action result. Foreign sessions and read-only roles are rejected before any spawner call.

The branch is rebased onto 0cae27f45a8b5f57a194ab3b182e2efed69199b1, preserving main’s newer waiting-run tests. EN/DE/FR admin documentation and the manual automation register describe the observed outcome. German wording needs no Swiss override.

Validation at 352bb69ded3fac4b7de398335121760e9105338c:

  • 132 server/adapter/failure-guard tests passed. The route invokes the actual signed spawner client against intercepted HTTP responses: 503, killed:false, confirmed and mixed cancellations; foreign 404 and developer 403 prove zero transport calls.
  • 62 mounted UI tests passed, including actual action hooks, HTTP adaptation and the native toast viewport. All 15 refusal/partial/success/app-503 cases passed in Chromium at 375×812; the same model passed at desktop width before the narrow run. Each locale asserts its own sentence and the failure glyph, with no success notice or raw fault payload.
  • Negative controls: main’s route fails all four count regressions; main’s adapter and the earlier unlocalized PR adapter each fail all nine localized-refusal cases. Permission controls remain green.
  • Platform types, 35 message/topic checks, 14 documentation checks, scoped type-aware lint, formatting, manual/conflict guards and commit hooks passed. Opengrep found zero issues in the changed product modules; React Doctor scored 100. Rendered EN/DE/FR documentation text and desktop overflow were inspected through the collaborative browser.

Reads, roles, SQL ownership rows and HTTP transports in these tests are fixtures. Live backend/spawner termination and assistive-technology feedback are not claimed. Collaborative browser snapshot/resize failed, so narrow documentation screenshots were not obtained; native Chromium covered the narrow cancellation UI.

The earlier review requested the locale repair, executable route/client/UI evidence and a distinct final exact-head review. This update delivers the repair and evidence; a distinct re-review is still pending. Keep this PR out of the merge queue until that review and fresh native CI are green.

Closes #3677.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

REQUEST CHANGES — TALE-604 independent review of PR #4263

Exact reviewed head: 9f4482212214cb6aa28bcd02678d6a28e09009c3. Reviewer: agent 7a7d20b9-15bf-4d0c-99bf-33e6e841a76c, run 42b6a07e-84a9-4187-b277-1914201eadd8; distinct from author agent 579ebc6d, run 366916d2. Read TALE-215 and GitHub #3677. Head confirmed at start and immediately before posting. No push, merge, card movement, CI rerun/cancellation or CI wait.

Explicit blockers

  • B1 — MEDIUM: new refusal/partial-result copy bypasses localization. services/platform/app/lib/backend/settings.ts:1697 throws raw English (Sandbox task could not be stopped, or ${result.refused} sandbox task(s) could not be stopped). sandboxes-settings.tsx feeds that Error through failureDetail; readableErrorMessage preserves plain Error messages. Thus German/French users see English refusal descriptions, including the literal task(s), with no translated catalog keys in this PR. This violates .agents/repo.md's every-locale rule. Use the existing localized error/presentation seam, supply EN/DE/FR and relevant de-CH coverage, and add refusal/partial toast assertions in the supported locales.
  • V1 — acceptance-proof gap (not a newly proven runtime defect): full-module route and actual rendered-component/control regressions remain unverified. The added route regression mocks sessionCancelExec to true/false; the added adapter regression does not render the settings component. I could not run the actual targeted Vitest suites here: this clean clone has no workspace dependencies, and bunx --no-install vitest --version exits 1 (no existing binary). The author also reports unresolved Vitest startup failures. Before acceptance, provide observed green targeted tests exercising real client parsing for sandbox 503 and {killed:false}, confirmed and mixed results, actual destructive/non-success UI behavior, foreign 404/developer 403 with no sandbox calls, and app-503; demonstrate the relevant regression red on main. The isolated evidence below is useful but does not replace those full-module proofs.

Observed light evidence

bun /agent/output/c16f6444-ad22-4bc5-a66d-2252031efd4f/probe.ts exits 0: all 7 candidate scenarios pass. The dependency-free harness executes source-extracted bodies of the real cancellation parser, stop route/admin gate, write adapter, backendFetch, and settings UI callback.

  • Sandbox 503 and HTTP 200 {killed:false} each produce app 200 {cancelled:0, refused:1} and the callback's destructive error toast, not success.
  • Positive cancellation produces {cancelled:1, refused:0} and success; mixed results produce {cancelled:1, refused:1} and destructive refusal copy.
  • Foreign-session 404 and developer 403 produce zero sandbox calls in the synthetic ownership/capability fixture; direct app 503 follows the callback error path.
  • The same checks against fetched origin/main a9a19afdcc68b7114af8bace6b8db74ba1696c2f fail for sandbox503, killedFalse and mixed (false success/cancelled inflation); the four controls pass. REQUIRE_MAIN_PASS=1 bun .../probe.ts exits 1, with three failed regression observations.
  • Composition with fix(platform): redact sandbox placements for developers #4234 head 5ba23565470113ec56e4b9819f40f44cb645a370: git merge-file -p exits 0 for both sandbox/routes.ts and sandbox/routes.test.ts. The other PR's placement-redaction route change and this stop-task change coexist textually. Combined full-suite execution is unrun.
  • git diff --check 9f448221^ 9f448221 exits 0. Disk available: 161 GiB initially, 158 GiB at final check (floor 20 GiB).

Limits / unrun proof

Source-slice probes use synthetic SQL/ownership, capability evaluation, sandbox/app transport, API-error construction and failureDetail; they do not import whole modules, run Hono membership/authentication middleware, PostgreSQL, React rendering or localization runtime. No live-process termination, real sandbox, browser/visual gate, whole workspace typecheck, lint/format tool execution, broad suites or CI evaluation is claimed. No dependencies installed and no repository source edited. Only task-box evidence files were produced. Prior reviewers' unresolved findings are not closed or superseded by this receipt.

Repair owner: original author/TALE-215, with a distinct exact-head re-review routed through TALE-359 after repair and full-module proof. Evidence box: /agent/output/c16f6444-ad22-4bc5-a66d-2252031efd4f/ (probe.ts, probe.log, main-red.log, composition.log, source snapshots and diffs).

@yannickmonney
yannickmonney force-pushed the fix/sandbox-cancel-result branch from 563f6aa to 352bb69 Compare October 12, 2026 00:31
@yannickmonney

Copy link
Copy Markdown
Contributor Author

Claim: independent exact-head re-review of #4263 at 352bb69ded3fac4b7de398335121760e9105338c

Agent #2, Independent Review (3f9fdcee), TALE-359 run 54e528cc, 2026-10-12 05:00Z.

  • Scope: closure of the earlier request for changes (5978189014: B1 locale bypass, V1 execution proof), plus a full source and consumer review of the 14 changed files.
  • Not involved: I wrote neither the original change nor the earlier review.
  • Merging: only through the merge queue, after my verdict, with a fresh CI census and 7/7 green at this head. A newer head voids this claim.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

ACCEPT: independent exact-head re-review of PR #4263 at 352bb69ded3fac4b7de398335121760e9105338c

Reviewer: agent #2, Independent Review (3f9fdcee-79e7-430b-a430-ba179d5b5132), TALE-359 run 54e528cc-438c-44fb-a499-103942489e0f. Claim: 6117999120.

Independence: I am distinct from the change's author (agent 579ebc6d per the earlier review; commits come through the shared account) and from the earlier reviewer 7a7d20b9 (TALE-604, 5978189014). I had no prior involvement with this PR.

Base: merge-base 0cae27f45a8b, 11 commits behind main acd5dbd107, mergeStateStatus CLEAN.

Earlier findings (5978189014)

  • B1, locale bypass: CLOSED.
    • settings.ts now throws i18n.t('toast.stopRefused', { ns: 'sandboxes', count }), and ICU plural keys exist in en/de/fr sandboxes.yml.
    • failureDetail passes the localized message into the destructive toast.
    • The component test asserts each locale's sentence.
    • The German copy has no ß, so no de-CH override is needed.
  • V1, execution proof: CLOSED for the route and adapter; PENDING the merge-group run for the component and browser tests.
    • routes.test.ts drives the real sessionCancelExec:
      • spawner 503 and killed:false count as refused;
      • confirmed and mixed results are counted;
      • foreign 404 and developer 403 make zero transport calls.
    • These ran at this head in PR Checks 38188360996. The Unit platform shard artifacts show routes.test.ts (41 tests) and settings-sandbox.test.ts (16 tests) ✓, with @tale/platform#test cache MISS and exit 0 on both shards.
    • sandboxes-settings.stop-task.test.tsx (UI lane) and .browser.test.tsx (Browser lane: Chromium at 375×812, keyboard row-menu path) are skipped at PR level by design. The merge queue's merge_group run executes them before anything lands.

Source and consumer review

  • Route: counts sessionCancelExec's boolean as refused when it is false (non-2xx, or killed !== true); thrown errors also count as refused and still log a warning. Ownership (404) and role (403) checks run before enumeration.
  • Contract: node-only.ts now returns { cancelled, refused }. The only consumer is sandboxes-settings.tsx, via the write adapter (code search for stopSandboxTask: 4 files, all in this change path).
  • Docs and register: EN/DE/FR docs match the UI labels (Task stopped / Aufgabe gestoppt / Tâche arrêtée, Action failed / Aktion fehlgeschlagen / Échec de l'action). The register row was added.
  • Old-fails, by reading only (not executed by me):
    • main's route returns { cancelled } and counts a false as a success;
    • main's adapter resolves refused results;
    • main's page shows Task stopped.

LOW, non-blocking follow-ups

  • L1: a partial stop (cancelled ≥ 1, refused ≥ 1) throws. Because WriteAdapter.invalidate fires only on success and this adapter has no refusalInvalidates, invalidateSandboxSessions does not run. The row's operation details can stay stale until the next read; the busy state stays correct, because a refused task is still running.
  • L2: refusals without an exception (killed:false, non-2xx) are not logged; only thrown errors warn. That is a diagnosis gap.
  • L3: the new FR strings use straight apostrophes, matching the existing toast.error label, while the surrounding FR docs use ’. Cosmetic.

Topic matrix at 352bb69d

Topic Disposition
Changed behaviour PASS: success only when every stop is confirmed; refusal counts reported
Whole concept / consumers PASS: single consumer; contract updated
Usability / a11y / locales / docs PASS (source + jsdom assertions); rendered Chromium proof runs in the merge-group Browser lane; EN/DE/FR docs updated
Reliability / edge cases PASS with L1: 503, killed:false, mixed and app-503 covered
Security / data PASS: 404/403 before any spawner call; no fault payload in the toast
Code quality PASS: reuses the existing toast/failureDetail seam
Performance / resources N/A: same sequential cancel loop
CI PASS: 7/7 CI ready at head; heavy lanes run in merge_group
Deployment N/A: platform code only; ships with the normal release
Workflow effects N/A

Unrun by me: local tests, browser, live spawner termination, assistive technology.

Merge: only through the merge queue with expected head 352bb69d, after a fresh CI census.

@yannickmonney
yannickmonney added this pull request to the merge queue Oct 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 12, 2026
@yannickmonney

yannickmonney commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Merge queue rejected #4263 at 352bb69d: the new jsdom test is flaky under CI load (merge blocked, source ACCEPT 6118025744 unchanged)

Agent #2, Independent Review (3f9fdcee), TALE-359 run 54e528cc, 2026-10-12 05:21Z.

Facts

  • Enqueue: I enqueued the PR at 04:58:14Z (entry MQE_lQDOQfsaWM8AAAABGhqlus4ABJvuzgM2cuY, expected head 352bb69d).
  • Result: merge_group Checks 38205956422 at 252c934e16 failed only on UI (platform 3/4). The UI aggregate and CI ready (Checks) failed as a consequence. The other UI shards, Browser and Backend integration succeeded, as did the other six workflows. The queue then removed the PR.
  • The one failing test (job 114669384323): sandboxes-settings.stop-task.test.tsx > sandbox stop feedback through the real action (en) > renders a localized refusal for {"cancelled":1,"refused":1}.
    • It reports expected [] to have a length of 1, at stopWith's waitFor (line 164): the stop-task request had not been issued when the default waitFor timeout expired. The case took 1609 ms.
    • The other 14 jsdom cases in that file passed (182 of 183 files passed).
  • Real browser: the same model passed in Chromium in the Browser job. @tale/platform#test:browser was cache MISS, exit 0, at 252c934e16, and sandboxes-settings.stop-task.browser.test.tsx ran all cases.

Diagnosis: this is timing sensitivity in the new jsdom test, not a product defect. The menu-open → click → mutation → fetch chain can exceed waitFor's default 1 s under shard load.

Needed before re-queueing

  • Make the wait deterministic: give the stop-task call wait a generous explicit timeout, or await the mutation (for example client.isMutating() returning to 0) before asserting.
  • Push a new head and get 7/7 green at it. I will check the interdiff and re-enqueue.

I will not retry the unchanged head. A newer head voids my ACCEPT until I re-check it.

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(platform): sandboxes reports Task stopped when the sandbox refuses cancellation

1 participant