Skip to content

Refactor Decopilot worker contract#4165

Open
tlgimenes wants to merge 23 commits into
mainfrom
decopilot-worker-contract-refactor
Open

Refactor Decopilot worker contract#4165
tlgimenes wants to merge 23 commits into
mainfrom
decopilot-worker-contract-refactor

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Narrows the desktop link worker contract to a v3 single-message harness input with explicit harness.sessionId, repo/no-repo cwd semantics, and protocol-version rejection with upgrade guidance.
  • Keeps Decopilot context/history loading inside the Decopilot implementation and removes unsupported desktop Decopilot runtime registration.
  • Moves shared CLI helpers out of Decopilot-specific modules and adds contract coverage for desktop CLI image work items.

Test Plan

  • bun test packages/sandbox/daemon/routes/dispatch.test.ts packages/sandbox/dispatch/schemas.test.ts packages/sandbox/daemon/rebase-workspace-cwd.test.ts packages/harness/src/workspace-cwd.test.ts
  • bun run check

Notes

  • Full Playwright e2e execution was previously blocked locally by missing NATS on 127.0.0.1:4222 / ::1:4222.
  • Live Chrome DevTools smoke against the provided app URL was blocked by that browser context redirecting to /login.

Summary by cubic

Moves Decopilot and CLI harnesses to link protocol v3: one userMessage, resume via harness.sessionId, and runId moved to the dispatch envelope. Removes the desktop Decopilot runtime, tightens workspace.cwd to null or /repo, and enables vision on CLI models for image inputs.

  • Migration

    • Upgrade the desktop link: run bunx decocms@latest link (v3 required; stale links show an upgrade message).
    • Send a single userMessage (no messages array); resume via harness.sessionId (not resumeSessionRef).
    • Set workspace.cwd to only null or /repo; the daemon rebases /repo and passes through null.
    • Put runId in the dispatch envelope (outside harnessInput); the daemon returns 400 missing_run_id when absent.
    • Decopilot is cluster-only; the desktop runtime is removed and the @decocms/harness ./decopilot export is gone.
    • Provide capabilities: { vision: true, text: true } on CLI models to accept image file parts.
  • Refactors

    • Added setDecopilotRunContext/requireDecopilotRunContext to carry Decopilot-only context (MCP, model sources, object storage, branch, user, prior messages) off the wire and load history in-cluster.
    • Moved shared helpers to @decocms/harness root (stream-error, current-context-prompt, thread-title, title-generator) and updated imports.
    • Updated claude-code and codex to v3: accept one userMessage, forward harness.sessionId, support image file parts, and stay decoupled from the Decopilot namespace.
    • Tightened sandbox dispatch: rebases symbolic cwd, enforces the v3 input schema, and exposes a link upgrade message; emits missing_run_id for bad envelopes.
    • Added tests for link-pull image parts, CLI isolation/import boundaries, v3 work items, and cwd rebasing; updated schemas/fixtures to the v3 contract.

Written for commit b74a0fd. Summary will update on new commits.

Review in cubic

@tlgimenes tlgimenes force-pushed the decopilot-worker-contract-refactor branch from 2add606 to 618a2fd Compare June 26, 2026 19:01
@tlgimenes tlgimenes force-pushed the decopilot-worker-contract-refactor branch from 26a2763 to b74a0fd Compare June 27, 2026 00:01
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.

1 participant