Skip to content

P0: implement bounded DevSpace -> Codeg thin execution gateway #220

Description

@James3014

Status

P0 — OWNER_AUTHORIZED / READY_FOR_BOUNDED_IMPLEMENTATION

Owner authorization: continue through Wave 2 completion.

Independent evidence adjudication on 2026-09-20 returned ADVANCE_TO_WAVE2. This Issue is the bounded brownfield implementation contract that follows #217; it does not rewrite #217's pilot history.

Evidence fence

Objective

Implement a thin DevSpace -> Codeg execution gateway beneath the existing DevSpace durable agent/control semantics so Codeg can own long-lived heterogeneous coding-agent execution while DevSpace remains the ChatGPT-facing workspace/control boundary.

The target shape is:

ChatGPT / Nexus controller
  -> existing DevSpace durable agent control surface
       identity / attemptKey / workspace authority / status / cancel / reconcile
       -> thin Codeg execution gateway
            -> Codeg work_task
                 -> Codex / OpenCode / Grok / Cline / Antigravity

Codeg is an executor/runtime only. Nexus/Owner retain route, scope, verification, acceptance, merge, release and production authority.

Brownfield requirement delta

The current DevSpace durable agent manager/store/control contract is retained. Wave 2 adds a replaceable Codeg execution backend and the minimum binding/reconciliation state needed to address Codeg work tasks.

Existing direct provider adapters are not deleted in Wave 2; they remain rollback/compatibility paths until a later separately-authorized retirement decision.

Binding requirements

REQ-001 — Preserve one durable DevSpace control authority

DevSpace SHALL preserve the existing public durable agent identity and workspace/attempt fencing semantics. The Codeg bridge SHALL NOT create a second DevSpace task/session/effect ledger, Planner, router, verifier or acceptance authority.

REQ-002 — Explicit backend selection

The Codeg execution backend SHALL be explicitly configured/admitted and SHALL be off-path when not configured. DevSpace SHALL NOT silently reroute a provider to Codeg based on model preference, failure, cost or hidden fallback.

REQ-003 — Exact workspace binding

For each Codeg-backed execution, DevSpace SHALL deterministically bind the exact DevSpace workspace root to the corresponding Codeg folder/workspace before task creation. A task SHALL NOT be created against a different folder because of stale history, basename collision or prior session state.

REQ-004 — Durable external handle before semantic completion

A Codeg-backed start SHALL persist the exact Codeg work_task identity as the external execution handle before the execution can be treated as durably started. Status, continuation, cancellation and reconciliation SHALL address that same handle.

REQ-005 — No blind duplicate create

The caller's existing DevSpace attemptKey / replay contract SHALL remain the idempotency authority. Because Codeg work-task create has no caller-supplied idempotency key, an ambiguous create/start outcome SHALL enter reconciliation; DevSpace SHALL NOT blindly create a replacement task.

REQ-006 — Provider/model projection only

Host-selected provider/model intent MAY be translated into the exact Codeg agent/config identifiers needed by Codeg. The gateway SHALL NOT choose a worker/model on behalf of Nexus/Owner, and SHALL NOT maintain a competing provider catalog truth source.

REQ-007 — Durable status and reconnect

After MCP/controller disconnect or DevSpace process restart, DevSpace SHALL be able to recover or reconcile the same Codeg task identity and return truthful running/review/completed/failed/canceled/unknown state. A DevSpace restart SHALL NOT convert a still-running Codeg task into a false terminal provider failure merely because the local wrapper process ended.

REQ-008 — Exact cancel

Cancellation SHALL target exactly one Codeg task handle. It SHALL NOT cancel sibling tasks or claim provider-side cancellation unless Codeg confirms it.

REQ-009 — Agy direct gateway path is mandatory

Wave 2 SHALL prove a direct ChatGPT -> DevSpace gateway -> Codeg built-in Antigravity work_task path. Raw ACP-only evidence and parent->Antigravity delegation are insufficient substitutes. The accepted live witness SHALL perform a bounded mutation in an isolated worktree and host-side readback SHALL verify the physical result. No yolo, permission bypass, DB mutation or safety-control bypass is allowed.

REQ-010 — Five-route live coverage

The integrated gateway SHALL complete bounded live work through Codeg for:

  • OpenCode
  • Grok
  • Codex
  • Cline
  • Google Antigravity/Agy

Each route must remain attributable to exact DevSpace operation/agent identity, Codeg task identity and isolated worktree.

REQ-011 — Real concurrency

At least three gateway-backed tasks SHALL have materially overlapping execution intervals. Sequential controller calls that merely queue work do not satisfy this requirement.

REQ-012 — Disconnect/recollection

A nonterminal gateway-backed task SHALL survive controller observation disconnect. After reconnect, the same DevSpace handle SHALL recollect/reconcile the original Codeg task; no replacement dispatch is allowed.

REQ-013 — False-green defense

Worker/result prose SHALL NOT be sufficient verification. Acceptance SHALL inspect Codeg task state plus physical worktree/file/diff evidence. The OpenCode Wave 1 missing-newline case is the required false-green model.

REQ-014 — Authority containment

The gateway SHALL NOT grant Codeg route selection, Candidate acceptance, merge, push, release, deployment, production or successor auto-chain authority. Codeg auto-merge/auto-chain SHALL remain disabled/out of scope.

REQ-015 — Secret containment

Codeg URL/token/private runtime configuration SHALL remain private configuration. Secrets SHALL NOT appear in MCP results, logs committed to Git, GitHub Issue evidence, worker prompts or public schemas.

REQ-016 — Rollback path

Existing direct DevSpace provider adapters SHALL remain available during Wave 2. This Issue does not authorize adapter deletion or production cutover.

Acceptance criteria

AC-001 — Contract/API preservation

Linked: REQ-001, REQ-002, REQ-014, REQ-016
PASS when existing non-Codeg agent_start/status/cancel/reconcile tests remain green and the Codeg path is explicit rather than default/fallback.
Negative control: Codeg unavailable/disabled must not silently fall back or mutate route truth.

AC-002 — Folder/workspace identity

Linked: REQ-003
PASS when two same-basename repositories in different absolute roots cannot cross-bind, and an existing Codeg folder for the exact path is reused rather than duplicated.

AC-003 — Start/replay/idempotency

Linked: REQ-004, REQ-005
PASS when exact replay of one DevSpace attempt returns/reconciles one Codeg task; changed payload under the same attempt key fails closed.
Negative control: simulate ambiguous create/start acknowledgement and prove no second task is blindly created.

AC-004 — Restart/reconcile

Linked: REQ-007, REQ-012
PASS when a Codeg task continues independently of the controller and the same external handle is recovered after reconnect/restart.
Negative control: missing/unreachable Codeg state reports unresolved/unknown, never fabricated success or absence.

AC-005 — Exact cancellation

Linked: REQ-008
PASS when canceling task A changes only A and concurrently running sibling B remains live/settles normally.

AC-006 — Five-route direct gateway canary

Linked: REQ-009, REQ-010, REQ-013
PASS only when all five providers complete bounded work through the integrated DevSpace gateway, including Antigravity through Codeg work_task, with independent host-side physical readback.

AC-007 — Concurrent execution

Linked: REQ-011
PASS when at least three exact task intervals overlap materially.

AC-008 — Authority/security negative controls

Linked: REQ-014, REQ-015, REQ-016
PASS when no gateway action exposes Codeg credentials, no Codeg action can merge/push/release through this bridge, and legacy adapters remain physically present.

AC-009 — Source/build quality

PASS when focused tests, affected full test suite, typecheck/build and package/runtime checks succeed on the exact Candidate. Test PASS is Candidate evidence only; it does not replace AC-004 through AC-008 live evidence.

AC-010 — Integrated runtime witness

PASS when the accepted Candidate is integrated/reloaded into the actual Dev MCP runtime and the live MCP action surface plus AC-004–AC-008 canaries are re-run against the integrated source identity.

Expected implementation shape

Prefer the smallest extension of existing primitives:

  • existing DevSpace durable agent manager/store remain the control-plane owner;
  • one thin Codeg client/execution adapter owns HTTP request/response translation and Codeg task-handle reconciliation;
  • provider-specific Codeg ids/config are edge translation only;
  • no new planner/router;
  • no duplicate task/session ledger.

The implementation may choose exact files after current-source inspection. Any material scope expansion requires a contract delta before mutation.

Verification / claim ceiling

Required evidence:

  • focused deterministic tests including negative controls above;
  • exact Candidate diff and source identity;
  • independent Candidate acceptance;
  • integrated/reloaded runtime identity;
  • five-provider live gateway canary;
  • concurrency, disconnect/reconcile, cancel and duplicate-ambiguity witnesses.

Maximum pre-integration claim: CANDIDATE_READY.

Maximum Wave 2 terminal claim: WAVE2_THIN_GATEWAY_COMPLETE only when AC-001..AC-010 are all satisfied on the integrated runtime.

This Issue does not authorize provider-adapter retirement, production cutover, release, or Wave 3.

Execution / authority

  • execution lane: DIRECT_CANONICAL in an isolated DevSpace-managed worktree based on e03fa9e...
  • deletion policy: FORBID
  • Owner authorization: explicit in current conversation on 2026-09-20
  • independent Candidate acceptance: required
  • merge/integration: only after Candidate acceptance; reverify exact integrated revision
  • AUTO_CHAIN outside this Wave 2 contract: false

Contract delta — durable recovery intent (2026-09-20)

Evidence requiring the delta

The first two Codex Luna xhigh implementation attempts exposed a bounded semantic gap in REQ-007 / REQ-012. A Codeg-backed DevSpace worker can terminate locally while the exact remote Codeg work_task continues. A later recovery cannot infer whether to recollect the unsettled prior turn or send a new continuation prompt from the remote task's current status alone: the task may legitimately advance from running to review after the local worker is gone. Using remote status as the discriminator can therefore convert an uncollected prior result into a new work_task_return side effect.

This is a DevSpace durable-state ownership problem, not a Codeg routing decision. The recovery semantic SHALL be persisted by the existing DevSpace lifecycle owner and SHALL survive local worker/process replacement.

REQ-017 — Durable recovery intent

DevSpace SHALL persist, within its existing local-agent lifecycle authority, whether a newly launched local worker turn is a normal continuation or a recollection of the previous unsettled Codeg turn. The marker SHALL be bound to the exact durable agent / lifecycle generation and exact Codeg task handle.

A recollection turn SHALL:

  • address the same persisted Codeg work_task handle;
  • perform read/poll/collect/materialize only;
  • SHALL NOT call work_task_create, work_task_start, or work_task_return;
  • remain recollection even if Codeg has already advanced the task from running to review before the recovery worker starts;
  • clear/settle the recovery intent only through the existing lifecycle CAS that settles the recovered turn.

A normal continuation after a successfully settled prior turn MAY use work_task_return against the same Codeg task when the task is in the expected review state.

DevSpace SHALL NOT infer recollection-vs-continuation from Codeg task status, prompt wording, process PID, transport session, or in-memory-only state.

AC-011 — Recovery-intent crash/race witness

Linked: REQ-004, REQ-007, REQ-012, REQ-017.

PASS only when deterministic tests prove both schedules:

  1. local worker is lost while Codeg remains running, then a recovery turn recollects the same task to terminal without create/start/return; and
  2. local worker is lost, Codeg reaches review before the recovery worker starts, and the persisted recovery intent still causes collection/materialization of that prior result without work_task_return.

Negative control: a genuinely successful prior DevSpace turn followed by an explicit new continuation must still be able to call work_task_return; recovery state must not leak across settled turns.

Authorized implementation-scope delta

The previous four-file scope was insufficient because the recovery discriminator must be durable rather than inferred. The bounded allowed path set for the next Candidate is expanded to:

  • src/local-agent-codeg.ts
  • src/local-agent-codeg.test.ts
  • src/local-agent-sessions.ts
  • src/local-agent-sessions.test.ts
  • src/local-agent-contract.ts
  • src/local-agent-store.ts
  • src/local-agent-store.test.ts

No server.ts / public MCP schema change is authorized by this delta. No new database table or second task ledger is authorized. Prefer a backwards-compatible optional field inside the existing persisted lifecycle JSON plus existing CAS transitions.

Deletion policy remains FORBID. Authority, merge/release limits, five-route integrated canary requirements, and all other #220 acceptance criteria remain unchanged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions