fix(agent-adapter): default codewith workers to exec, not durable agent start#21
Open
andrei-hasna wants to merge 1 commit into
Open
fix(agent-adapter): default codewith workers to exec, not durable agent start#21andrei-hasna wants to merge 1 commit into
andrei-hasna wants to merge 1 commit into
Conversation
…nt start
The loops codewith adapter launched every worker via `codewith agent start`
(the durable background daemon). That daemon reloads large session history per
turn, hits context_length_exceeded, and silently completes with no work, so
every codewith-provider drain (PR-merge queue, fleet-reliability, data-platform)
dispatched workers that did nothing. Codewith 0.1.51 also no longer accepts the
`--json` flag on `agent start`, so route/task-lifecycle steps failed at triage
with "codewith agent start exited with code 2".
Switch the default codewith execution path to one-shot `codewith exec`
(non-interactive, honors --auth-profile, reaches the network, mirrors the codex
adapter). The prompt travels on stdin via `codewith exec -`, keeping it off
argv/ps. workspace-write sandboxes block network egress by default, so enable it
explicitly with `-c sandbox_workspace_write.network_access=true` so model-run
gh/git commands can reach GitHub (verified: the config key is recognized and the
exec arg vector parses and streams JSONL against codewith 0.1.51).
The durable `agent start` path stays available behind an opt-in
`codewithMode: "agent"` target flag; existing loops with no flag default to exec
and are fixed automatically. Codewith remains local-only in both modes (remote
durable readback and remote exec verification are separate work), failing closed
on a remote machine rather than dispatching to an unverified transport.
- add AgentTarget.codewithMode ("exec" default | "agent") with validation
- gate the durable start/read/logs poller on codewithMode="agent"
- add codewithUsesDurableAgent/resolveCodewithMode helpers
- rename UNSAFE_CODEWITH_DURABLE_EXTRA_ARGS -> RESERVED_CODEWITH_MANAGED_ARGS
- update capabilities.promptChannel to stdin; refresh README/USAGE docs
- tests: new exec-default and remote-exec-guard cases; opt existing durable
tests into codewithMode="agent"
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Contributor
Author
|
Worker review result for todos task 0886e268-3fa8-4537-ae55-bea86221c2f5: not safe to merge as-is. Blockers:
Validation on current main/worktree:
Follow-up todo created for the separable question of whether the PR-only |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem (blocker — unblocks ALL codewith drains fleet-wide)
The loops codewith adapter launched every worker via
codewith agent start(the durable background daemon). That path is broken two ways on the current fleet:context_length_exceeded→ completes in ~10s with a null message and no work done. Every codewith-provider drain (PR-merge queue,fleet-reliability-drain, DATA-PLATFORM AWS-RDS drains) dispatched workers that did nothing.agent startno longer accepts--json, so route/task-lifecycle steps failed at triage withstep triage failed: codewith agent start exited with code 2/unexpected argument --json.codewith execworks fine (it is the documented working delegation path).Fix
Switch the default codewith execution path to one-shot
codewith exec(non-interactive, honors--auth-profile, reaches the network, mirrors the codex adapter):codewith exec -, keeping it off argv/ps.workspace-writesandboxes block network egress by default, so gh/git could not reach GitHub (exactly the merge-worker failure recorded in the PR-merge diagnosis: "git fetch … Could not resolve host github.com"). The exec path now adds-c sandbox_workspace_write.network_access=trueforworkspace-writeso model-rungh/gitcommands complete.danger-full-accessis already unrestricted;read-onlyworkers stay egress-off.--auth-profile,--sandbox,--cd,--add-dir,--model, reasoning effort,--json/--ephemeral/--ignore-rules/--skip-git-repo-check, and worktree handling.The durable
agent startpath stays available behind an opt-incodewithMode: "agent"target flag. Existing loops with no flag default to exec and are fixed automatically (no migration/backfill needed).Codewith remains local-only in both modes (
capabilities.remote=false): remote durable readback and remote-exec verification are separate work, so a codewith step on a remote machine fails closed rather than dispatching to an unverified transport.Verification against codewith 0.1.51 (real CLI)
--jsonJSONL, and reads the prompt from stdin via-.sandbox_workspace_write.network_accessis a recognized config field (--strict-configaccepts it; a bogus key is rejected).Changes
src/types.ts: addAgentTarget.codewithMode("exec"default |"agent").src/lib/agent-adapter.ts: exec-default codewith invocation + opt-in durable branch;codewithUsesDurableAgent/resolveCodewithModehelpers;codewithModevalidation;promptChannel: "stdin"; renameUNSAFE_CODEWITH_DURABLE_EXTRA_ARGS→RESERVED_CODEWITH_MANAGED_ARGS.src/lib/executor.ts: gate the durable start/read/logs poller oncodewithMode="agent"; keep codewith local-only in both modes.README.md/docs/USAGE.md: describe the new default + opt-in agent mode.codewithMode: "agent".Checks
bun run typecheck✓ ·bun test→ 550 pass / 0 fail ✓ ·bun run build✓ ·bun run test:boundary✓Landing note
This restores the merge pipeline together with the admission-gate fix (49f5670c). Do not self-merge — needs an adversarial reviewer and a separate merger per the delivery contract.
Follow-ups (out of scope, noted for reviewer)
workspace-write-without-egress default; if codex is also used for network work, it needs the samenetwork_accesstreatment..git/worktrees/<name>(outside the worktree cwd); confirm the sandbox policy or--add-dir/repoRoot covers that forgit commit/push.