Repository navigation
feat(sandbox): confirm before auto-starting on another member's thread - #5086
Merged
Merged
Conversation
Opening another org member's thread by URL silently auto-started a sandbox on the creator's branch (the read-only gate only covered the chat composer, not the sandbox/CMS). Hold auto-start behind a confirmation gate for threads owned by someone else: the preview shows a card identifying the thread with "Continue anyway" / "Start new chat" instead of booting. - shouldAutoStart: new autoStartBlocked flag - computePreviewState: new "othersThread" gate state (wins before starting) - SandboxLifecycleProvider: othersThreadLabel prop + acknowledge action, gate keyed by branch so switching threads re-arms it - "Start new chat" navigates to a fresh thread with no branch, so the server scopes it to the user's own warm branch (never the creator's) - i18n (en + pt-br), tests for the gate Client-side mitigation; the authoritative server-side ownership scope on COLLECTION_THREADS_GET is a follow-up. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Addresses correctness + testing findings from PR review: - Gate self-heal too: shouldSelfHeal now honors autoStartBlocked, so a stale dead-handle can't silently reprovision a sandbox on another member's branch while the confirmation gate is up. - Key the acknowledgement by thread id, not branch. Fixes the null-branch case where the server assigning a branch re-armed the gate mid-boot (re-prompt + a second SANDBOX_START), and stops two members' threads that collide on a branch name from sharing an acknowledgement. - Extract deriveOthersThreadLabel + computeOthersThreadGate as pure, unit-tested helpers (the ownership rule and gate derivation were provider-internal before — an inverted comparison would have shipped green). 11 new helper cases + self-heal-blocked + gate-vs-suspended / gate-vs-errored precedence. - Rename the card prop onStartNewChat → onStartNewThread (code = thread). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
Author
Self-review (parallel critics: correctness / security / architecture / testing)Ran a multi-perspective review and pushed fixes for the substantive findings in Fixed
Deferred (tracked, not in this PR)
|
decocms Bot
pushed a commit
that referenced
this pull request
Jul 23, 2026
PR: #5086 feat(sandbox): confirm before auto-starting on another member's thread Bump type: minor - decocms (apps/mesh/package.json): 4.100.2 -> 4.101.0 Deploy-Scope: web
rafavalls
added a commit
that referenced
this pull request
Jul 23, 2026
Only conflict was apps/mesh/src/web/components/sandbox/preview/preview.tsx, where main's new preview "display model" (#5084 production fallback while the dev server wakes, #5089 resilient path-param picker, #5086 confirm-before- auto-start) collided with this branch's header-portal redesign of the same toolbar. Resolution: keep the redesign's structure (urlControls / moreMenu extracted and portaled into the panel header via headerSlot) and adopt main's display model: - showPreviewToolbar now follows main's visibility — shown once an iframe surface is active (sandbox when the daemon is up, or the production fallback while it wakes) instead of `daemonReady && previewState.kind === "iframe"`. - canVisualEdit uses `display.mode === "sandbox"`. - "Open in new tab" resolves the URL via `iframeSrc ?? display.iframeBase` (previewState.previewUrl no longer exists under the display model). Main's toolbar-internal changes were pure re-indentation (verified against the base diff), so the extracted urlControls/moreMenu already carry them; main's other features (waking pill, confirm dialog) live outside the toolbar and auto-merged. Verified: tsc across all workspaces, oxlint (0), knip (clean), format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opening another org member's thread by URL (
/<org>/<threadId>) silently auto-started a sandbox on the creator's branch. The existing "read-only" guard only replaced the chat composer — the sandbox/CMS preview kept booting and stayed fully editable, so a user could edit (and commit to) someone else's branch without ever choosing to.This adds a confirmation gate: when the active thread belongs to someone else, the sandbox does not auto-start. The preview shows a card identifying the thread with two actions:
On your own thread nothing changes.
How it works
shouldAutoStartgains anautoStartBlockedflag.computePreviewStategains anothersThreadstate that wins beforestarting(but yields to a livepreviewUrl, i.e. once acknowledged).SandboxLifecycleProvidertakes anothersThreadLabelprop (branch, or title fallback) and anacknowledgeOthersThread()action; the acknowledgement is keyed by branch so switching threads re-arms the gate.VmEventsBridgecomputesothersThreadLabelfromactiveTask.created_by !== userId— the same signal the chat composer's read-only banner already uses.content-browsernarrows out the new state (the Content tab is gated behindphase === "running"and never passes the gate).Scope
This is a client-side mitigation, matching the existing read-only banner. The authoritative fixes are follow-ups:
COLLECTION_THREADS_GET(storage/threads.ts) scopes only by org, not owner — any member can open any thread id by URL.Testing
bun run --cwd=apps/mesh check✅bun test apps/mesh/src/web/components/sandbox/→ 385 pass ✅ (added cases forshouldAutoStartblocked,computeDrawerStatusothersThread→idle, andcomputePreviewStategate precedence)bun run lint— no new warnings ✅bun run fmtapplied ✅🤖 Generated with Claude Code
Summary by cubic
Add a confirmation gate before auto-starting the sandbox when opening another member’s thread to prevent silent boot/edits on their branch. Users can continue on that branch or start a new thread on their own.
New Features
autoStartBlocked; Preview shows a card with the thread label and actions: “Continue anyway” or “Start new chat”.othersThreadgate that wins beforestarting; Content remains gated byphase === "running".SandboxLifecycleProvidernow takesothersThreadLabel+othersThreadIdand exposesacknowledgeOthersThread();VmEventsBridgederives the label withderiveOthersThreadLabel.Bug Fixes
shouldSelfHeal), preventing silent reprovision on another member’s branch.Written for commit 52f9507. Summary will update on new commits.