Skip to content

feat(server): persist and reattach execution environments - #514

Merged
JAORMX merged 3 commits into
mainfrom
feat/issue-462-remote-environments
Aug 14, 2026
Merged

JAORMX merged 3 commits into
mainfrom
feat/issue-462-remote-environments

Conversation

@JAORMX

@JAORMX JAORMX commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Final implementation phase of #462:

  • persist session.EnvironmentRef in session snapshots with legacy compatibility
  • stamp local/no-fs refs at create time and lazily stamp legacy sessions after successful resolution
  • add a context-aware server.Config.EnvironmentResolver for non-in-tree environment kinds
  • fail loudly on missing resolver, mismatched refs, or invalid resolved Environments
  • keep environment reattachment independent from provider/model SessionEngine rehydration
  • add deterministic internal/adapter/remoteenv reference backend proving shared file/runner namespaces, cross-handle CAS, complete isolated forks, ref-addressed merge/conflict behavior, and restart reattachment
  • add ADR 0106, cloud-native fidelity inventory, API/CHANGELOG and embedding docs

No production remote transport, credentials, flags, proto changes, network calls, or external dependencies are introduced. The remote adapter is an in-process contract proof only.

Verification

  • task build
  • task lint
  • task test
  • task api:check
  • task docs
  • task site:build
  • go run ./cmd/mecademo
  • focused remoteenv, resolver, snapshot legacy/forward compatibility and no-fs tests
  • git diff --check

Closes #462

@JAORMX
JAORMX force-pushed the feat/issue-462-remote-environments branch from 27657c0 to 797930c Compare August 13, 2026 21:37
JAORMX and others added 2 commits August 14, 2026 00:17
Four call sites still constructed session.EnvironmentRef{Kind:
EnvKindNoFS, ID: ""} by hand instead of calling the single-source
helper the ref-persistence work (ADR 0106) introduced, so the
"collapsed duplicate derivation" claim wasn't quite true. All four
are behind profile == ProfileNoFS with sess in scope, so the value
is unchanged.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

@jhrozek jhrozek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the architectural shape with a go-architect (opus) + software-architect panel focused on fit against AGENTS.md's layering rules and ADR 0105/0106: layering, composition ownership of the resolver seam, the fail-loud contract, and package placement all check out. No ship-blockers.

One mechanical finding from that review addressed in 198268f: four call sites in service.go still hand-constructed session.EnvironmentRef{Kind: EnvKindNoFS, ID: ""} instead of going through defaultEnvironmentRef, the single-source helper this PR introduces for exactly that value. All behind profile == ProfileNoFS with sess in scope, so the resulting value is unchanged — routed through the helper for real single-source discipline. Build/lint/test green.

Remaining review note (not blocking, worth a follow-up): both reviewers independently flagged internal/adapter/remoteenv as larger than its contract-proof job needs — it re-implements chunks of memfs (glob/grep/versioning) rather than wrapping it, and the fork/merge conflict-detection logic goes beyond proving reattachment into speculative merge-protocol design. Worth thinning out before a real transport adapter uses it as a reference, but doesn't affect correctness of what's landing here.

@JAORMX
JAORMX merged commit 8d59738 into main Aug 14, 2026
15 of 16 checks passed
@JAORMX
JAORMX deleted the feat/issue-462-remote-environments branch August 14, 2026 05:03
jbeda added a commit that referenced this pull request Aug 15, 2026
…classification)

- Track #503/#514 execution-environment seam: Run/ResumeApproval take
  tool.Environment (agent.EnvForWS), fakeTool exec keeps the Workspace contract
  (Execute bridges via env.Workspace()); blocking-steer test stubs take
  tool.Environment.
- Track #368 caller separation: Steer/CancelSteer authorize via GetSession
  before touching the run registry / run-entry funnel (foreign = absence-equivalent),
  and register both in serviceAccessTable (ADR 0102 decision 2) — closes the
  cross-caller steer-injection gap the classification invariant surfaced.
- gci-format model.go post-merge.

Co-Authored-By: mecatl <[email protected]>
jbeda added a commit that referenced this pull request Aug 18, 2026
…classification)

- Track #503/#514 execution-environment seam: Run/ResumeApproval take
  tool.Environment (agent.EnvForWS), fakeTool exec keeps the Workspace contract
  (Execute bridges via env.Workspace()); blocking-steer test stubs take
  tool.Environment.
- Track #368 caller separation: Steer/CancelSteer authorize via GetSession
  before touching the run registry / run-entry funnel (foreign = absence-equivalent),
  and register both in serviceAccessTable (ADR 0102 decision 2) — closes the
  cross-caller steer-injection gap the classification invariant surfaced.
- gci-format model.go post-merge.

Co-Authored-By: mecatl <[email protected]>
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.

refactor(engine): model coding work as an execution environment

2 participants