Skip to content

feat(workspaces): Add database-backed repository workspaces - #1420

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

feat(workspaces): Add database-backed repository workspaces#1420
sentry-junior[bot] wants to merge 34 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 database-backed repository Workspaces that agents can list and switch through the core tool registry. Junior stores install-wide recipes and repository rows in SQL. The active Workspace remains part of the durable Sandbox reference, so conversation history and resumed sessions keep the selected repository context.

Workspace activation now builds and probes a candidate Sandbox before it persists the new reference or replaces the live Sandbox. A failed or canceled candidate leaves the current Sandbox and durable state unchanged.

GitHub repositories clone through the existing host-managed credential egress with normal HTTPS remotes. Installation credentials are not added to Sandbox environment variables or Git config. Each complete Workspace recipe selects one snapshot profile and one build path, without a base-to-Workspace snapshot cache graph.

@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 14, 2026 6:56am

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 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/session.ts
Comment thread packages/junior/src/chat/api-turns/work.ts Outdated
Comment thread packages/junior/src/chat/sandbox/session.ts Outdated
Comment thread packages/junior/migrations/meta/0025_snapshot.json Outdated
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/workspaces/store.ts
Comment thread packages/junior/src/chat/sandbox/session.ts Outdated
Comment thread packages/junior/src/chat/sandbox/session.ts Outdated
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
sentry-junior Bot and others added 25 commits August 13, 2026 23:39
Reject an already-aborted workspace switch before mutating recipe state or stopping the live sandbox.
Order workspace repos by provider/repo/checkout path in the store and
normalize that order in the snapshot profile hash so identical recipes
do not rebuild snapshots from query-order churn.
If ensureReadySandbox fails after acquisition, stop the replacement
session instead of dropping the only reference without cleanup.
Do not stop a resumed durable sandbox when network policy or prepare
fails. Leave the VM for a later reacquire instead of wiping prior state.
Capture prepareWorkspace recipes by value, restore cold durable sandbox
hints on failed switch, and omit isPrimary from snapshot profile hashes.
After aborting an in-flight acquire, stop any session remembered while
awaiting that promise, not only the pre-await previous sandbox.
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.
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>
Defer stopping the previous session until the replacement is ready so a
cancelled or failed switch can put the live sandbox back.
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.
Forward the acquire AbortSignal into prepareWorkspaceSnapshot so long
setup scripts stop when a workspace switch or turn is cancelled.
Keep durable sandbox clear signals through run adapters so a failed inline
persist still clears on the final write. Reject reserved checkout paths
case-insensitively, and sort workspace recipe repos with code-point order
for locale-stable profile hashes.
Drop stored checkout_path from workspace recipes. Clone workspace and
ad-hoc GitHub repositories under repos/{name} so setup scripts can rely
on a stable layout, and reject short-name collisions.
findSingleRepositoryDirectory now looks in repos/{name} so ad-hoc and
workspace clones keep automatic AGENTS.md selection after the layout change.
Invalid workspace repo names no longer throw during AGENTS.md capture.
Fall back to single-repo discovery or skip instructions instead of
aborting the agent turn.

@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 214dfb3. Configure here.

Comment thread packages/junior/src/chat/sandbox/snapshot/profile.ts Outdated
Always including `workspace: null` changed every base dependency profile
hash and would bust cached snapshots on deploy. Only include the
workspace recipe when a workspace is selected.
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