Skip to content

feat(workspaces): Add switchable repository workspaces - #1420

Open
sentry-junior[bot] wants to merge 28 commits into
mainfrom
feat/workspace-mvp
Open

feat(workspaces): Add switchable repository workspaces#1420
sentry-junior[bot] wants to merge 28 commits into
mainfrom
feat/workspace-mvp

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Closes #1417.

Adds the first workspace vertical slice:

  • Store named workspace recipes and their repositories in SQL.
  • Expose listWorkspaces and switchWorkspace through the core tool registry.
  • Build repository clones and setup scripts into reusable snapshot profiles.
  • Persist the active workspace with the sandbox reference.
  • Use the primary repository for AGENTS.md selection.

Workspace switches replace the live sandbox. Conversation history remains intact. GitHub snapshot preparation uses a bounded installation token and does not put the token in command arguments.

Requested by David Cramer.

--

View Junior Session [Sentry]

Co-Authored-By: David Cramer <david@sentry.io>
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview Aug 12, 2026 11:01pm

Request Review

@dcramer
dcramer marked this pull request as ready for review August 11, 2026 16:48
@github-actions github-actions Bot added the risk: high PR risk score: high label Aug 11, 2026
Comment thread packages/junior-github/src/plugin.ts
Comment thread packages/junior/src/chat/sandbox/session.ts
Comment thread packages/junior/src/chat/sandbox/session.ts Outdated
Abort in-flight sandbox acquires on switch, roll recipe state back if the new boot fails, and store explicit checkout paths so multi-repo workspaces cannot collide.
Comment thread packages/junior/src/chat/sandbox/session.ts
Comment thread packages/junior/src/chat/api-turns/work.ts
Durability handlers were coercing null to undefined before thread-state
persist, so failed workspace switches left stale sandbox/workspace ids.
Workspace profiles now hash baseHash + recipe and build by booting the
cached base dependency snapshot, then running prepare. Base busts still
invalidate workspace snapshots because the base hash is in the key.

Co-Authored-By: immutable dcramer <david@sentry.io>
Key workspace snapshots by the resolved base snapshot id, refresh same-id recipes when their profile changes, and document the owning lifecycle rules.

Co-Authored-By: immutable dcramer <david@sentry.io>
Resolve the 0025 migration collision by keeping main's MCP credential
subject migration and renumbering workspaces to 0026.

Co-Authored-By: immutable dcramer <david@sentry.io>
Comment thread packages/junior/src/chat/sandbox/session.ts
Idempotent switchWorkspace must no-op on matching recipe even when the
provider session is cold, or it clears sandboxRef and boots a fresh sandbox.
The workspace migration is now 0026 after main claimed 0025, so the
scheduled-task SQL adoption test expects 11 migrated core migrations.
Comment thread packages/junior/migrations/meta/0025_snapshot.json Outdated
Keep main's migration snapshot byte-identical; the trailing newline
change was merge noise unrelated to workspaces.
Comment thread packages/junior/src/chat/sandbox/session.ts Outdated
Comment thread packages/junior/src/chat/sandbox/session.ts
Comment thread packages/junior/src/chat/sandbox/session.ts Outdated
Comment thread packages/junior/src/chat/sandbox/snapshot/profile.ts
Capture prepareWorkspace recipes by value, restore cold durable sandbox
hints on failed switch, and omit isPrimary from snapshot profile hashes.
Comment thread packages/junior/src/chat/sandbox/session.ts Outdated
After aborting an in-flight acquire, stop any session remembered while
awaiting that promise, not only the pre-await previous sandbox.
Comment thread packages/junior/src/chat/sandbox/session.ts Outdated
When an aborted acquire still reports a durable sandbox ref, clear that
hint after stopping the late session so switch boots the target fresh.
Bare rejects.toThrow() failed lint under --deny-warnings.
Co-Authored-By: David Cramer <david@sentry.io>
Share the reserved root names with cloneRepository and fail workspace
prepare before cloning into skills, data, or .junior.

Co-Authored-By: David Cramer <david@sentry.io>
Comment thread packages/junior/src/chat/sandbox/sandbox.ts
Comment thread packages/junior/src/chat/sandbox/session.ts Outdated
Defer stopping the previous session until the replacement is ready so a
cancelled or failed switch can put the live sandbox back.
@dcramer

dcramer commented Aug 12, 2026

Copy link
Copy Markdown
Member

alright lets rebase this agian. we've changed a bunch of the core stuff in main

# Conflicts:
#	packages/junior/migrations/meta/0027_snapshot.json
#	packages/junior/migrations/meta/_journal.json
#	packages/junior/src/chat/agent/tools.ts
#	packages/junior/src/chat/tools/types.ts
Comment thread packages/junior/src/chat/agent/tools.ts
Preserve workspaceId and profile hash on SandboxRef restore when the
workspace recipe row cannot be loaded, instead of silently stripping the
association on the next report.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7c65823. Configure here.

Comment thread packages/junior/src/chat/sandbox/session.ts Outdated
Comment thread packages/junior/src/chat/sandbox/session.ts
Forward the acquire AbortSignal into prepareWorkspaceSnapshot so long
setup scripts stop when a workspace switch or turn is cancelled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Research switchable snapshot workspace baselines

1 participant