GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(core): add remote workspace lifecycle seam by kitlangton · Pull Request #37437 · anomalyco/opencode

Conversation

@kitlangton

@kitlangton kitlangton commented Jul 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

What

Introduce the provider-neutral lifecycle and environment seam for centrally executed V2 Sessions to address hosted Workspaces without touching the server host checkout.

  • Adds browser-safe Workspace.Info metadata.
  • Adds provider-neutral create, connect, suspend, reconcile, and delete contracts.
  • Adds a lazy, scoped, idle-expiring Workspace connection cache.
  • Fences lifecycle transitions against active file and process leases.
  • Resolves hosted Location project metadata from the Workspace record instead of host-local Project.resolve.
  • Keeps implicit-local Location behavior unchanged.
  • Includes the staged implementation plan in specs/v2/remote-workspace-execution.md.

How

  • packages/core/src/workspace.ts owns Workspace creation, connection, suspension, and removal; compensates failed initial persistence; persists replacement bindings before reconciliation; and keeps deletion retryable when the provider fails.
  • A keyed writer-preferring lifecycle gate closes admission, drains scoped borrows, runs one transition, and reopens admission on success, failure, or interruption.
  • packages/core/src/workspace.ts reads durable metadata independently from provider connection, shares concurrent connections through RcMap, and immediately evicts failed acquisitions.
  • packages/core/src/workspace/sandbox.ts requires a versioned kind: "sandbox" placement envelope before V2 can interpret legacy Workspace JSON. Providers own binding decoding and lifecycle operations.
  • packages/core/src/workspace/environment.ts binds separate local and hosted Location services. Hosted file operations borrow one connection, resolve provider-canonical paths, and reject direct or symlink escapes outside the Workspace root.
  • packages/core/src/location.ts selects local Project resolution or hosted Workspace metadata at node-binding time and lexically rejects working directories outside the durable Workspace root.
  • Local mutations share one keyed target lock, including ordinary writes, conditional writes, exclusive creates, and removal.

Scope

This PR establishes placement, lifecycle, and connection seams only.

  • No Vercel, Daytona, Modal, or E2B production adapter.
  • No public HTTP or product provisioning surface for hosted Workspaces.
  • No migration of existing file, shell, search, config, VCS, PTY, snapshot, or watcher consumers.
  • No claim that a complete hosted Session can execute tools yet.
  • Hosted Location lookup errors still follow the current infallible Location-layer boot contract; transport-level placement errors are deferred with the public Workspace API surface.

Testing

  • bun run test test/workspace.test.ts test/location.test.ts test/location-layer.test.ts: 20 passed.
  • bun run test --rerun-each 10 test/workspace.test.ts: 10 consecutive lifecycle runs passed.
  • Lifecycle coverage includes stable create identity, failed-persistence compensation, shared scoped connections, suspend draining and admission fencing, replacement-binding reconnection, retryable provider deletion, and final row removal.
  • Live Modal SDK 1.5.2 tracer verified Sandbox creation, reconnection by ID, direct file operations, foreground commands, timeout cleanup, filesystem snapshot and restoration, retained writable files, credential isolation, and Sandbox cleanup.
  • Modal timeout verification observed the command gone while the Python SDK resolved with -1; current Python and JavaScript process handles expose no direct per-process termination.
  • bun typecheck in packages/core, packages/schema, packages/protocol, packages/server, packages/sdk-next, and packages/opencode.
  • Push hook: bun turbo typecheck --concurrency=3, 32 configured tasks passed.
  • bun run migration --check in packages/core.
  • Prettier and git diff --check passed.
  • Simplify review completed with separate reuse, quality, and efficiency passes, followed by a focused Effect lifecycle review.
  • Full Core run: 1,323 passed, 6 skipped, 10 failed. The failures are 9 existing provider-opencode five-second timeouts and 1 provider-openai polling timeout; both reproduce independently and do not touch Workspace or Location code.

Flow

sequenceDiagram
  participant L as Location graph
  participant W as Workspace lifecycle
  participant G as Lifecycle gate
  participant C as Connection cache
  participant P as Sandbox provider

  L->>W: get(workspaceID)
  W-->>L: project and root metadata
  Note over L,P: No provider connection during Location boot
  L->>G: borrow read lease
  G->>C: acquire shared connection
  C->>P: decode and connect on cache miss
  P-->>C: environment and replacement binding
  C->>P: reconcile(binding)
  C-->>L: hosted environment
  W->>G: suspend or remove
  G-->>W: wait for active leases, block new leases
  W->>P: transition provider state
  W->>W: persist replacement binding
  W->>G: reopen admission
Loading

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kitlangton added 2 commits July 16, 2026 23:17
@kitlangton
docs: plan remote workspace execution
09903e1
@kitlangton
feat(core): add remote workspace environment seam
fd92aea
@github-actions github-actions Bot added the contributor label Jul 17, 2026
@kitlangton
docs(core): record Modal sandbox tracer
d1b9b6c
@kitlangton
kitlangton marked this pull request as draft July 18, 2026 02:25
@kitlangton
feat(core): add workspace lifecycle
650d5a5
@kitlangton kitlangton changed the title feat(core): add remote workspace environment seam feat(core): add remote workspace lifecycle seam Jul 18, 2026
@Alter-Igor Alter-Igor mentioned this pull request Jul 18, 2026
Session execution: V1 and V2 stacks can execute the same session concurrently (no cross-stack guard) #37615
Closed
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Aug 17, 2026
@github-actions github-actions Bot added the automated-pr-cleanup label Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

automated-pr-cleanup contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@kitlangton
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.