Repository navigation
Description
Scope
Keep this implementation deliberately small. The goal is to establish the basic Work/Code agent distinction, not to redesign AlphaCode's runtime, CLI, permissions, context system, or orchestration architecture.
Required behavior
- Work is the general-purpose agent.
- Code is the software-engineering agent.
- Work can delegate to Code.
- Code cannot delegate to Work.
- Code has access to LSP functionality.
- Work does not have access to LSP functionality.
Delegation should use the existing task/subagent mechanism and preserve the existing result/finish contract. Enforce directionality at the actual agent/tool configuration seam, not only through prompts.
LSP availability must be enforced through actual tool/context registration, not merely instructions. Reuse existing LSP tooling for Code; do not build a parallel LSP system.
Explicitly out of scope
Do not add:
- automatic cwd/project inference
alphacode code/alphacode workCLI entry points- new permission models
- new context systems or context-firewall architecture
- bounded orchestration frameworks
- recursive delegation machinery
- workspace/project detection
- separate runtime implementations unless the existing architecture genuinely requires one
- unrelated Work/Code specialization
The six required behaviors above are the acceptance criteria. Everything else is unnecessary unless required by the existing architecture to implement them correctly.
Tests
Add focused regression coverage for:
- Work resolves to Work.
- Code resolves to Code.
- Work can delegate to Code through the real delegation path.
- Code cannot delegate to Work.
- Code receives LSP tools/context.
- Work does not receive LSP tools/context.
- Existing unrelated agent/delegation behavior remains unchanged.
Do not add hypothetical CLI/runtime tests for features outside this scope.
Implementation / PR requirements
Start from current dev. Inspect the existing agent definitions, tool registration, delegation/task mechanism, and LSP integration before changing anything. Reuse existing infrastructure wherever possible.
Run focused tests, relevant package tests, typecheck, and lint/format checks. Inspect the final diff and remove unnecessary changes.
Open the PR against dev and use the repository PR template exactly. The PR must close this issue (Closes #99), use the correct change type, contain a concise concrete explanation of what changed and why it works, include actual verification results, and include a screenshot/recording only if the implementation genuinely changes UI. Do not paste a large AI-generated PR description.
Activity
mdev34-lab commentedon Sep 15, 2026
Autopsy of PR #132
PR #132 was closed without merge after 9 commits and 38 changed files. The implementation did not fail because the core idea was invalid. It failed because the first implementation was too broad, and the review cycle kept expanding the surface area instead of converging on the smallest contract that #99 actually required. urlPR #132https://github.com/mdev34-lab/alphacode/pull/132
What went wrong
The issue bundled several architectural changes into one PR.
feat(agent): split Work and Code into specialized runtimes with first-class delegation #99 asks for two specialized agents, launch selection, first-class delegation, a context firewall, and bounded nesting. PR feat(agent): split Work and Code into specialized runtimes with first-class delegation #132 implemented all of that at once: new agent-selection infrastructure, a Code prompt/project overview, a new delegate runtime, permission isolation, commit policy, timeout/cancellation, result derivation, CLI behavior, and TUI inference. That made every review finding capable of triggering another cross-cutting change.
The delegation contract was initially underspecified in code.
The first implementation mixed Work/Code topology with
subagent_depth. Review then had to disentangle two separate concepts: which delegation edges are legal versus how deep delegation may nest. Later commits moved the topology check into the delegate runtime and madesubagent_deptha pure depth limit. Future work should define these invariants before implementation:work → codeandcode → workare legal;Security/permission semantics were initially implemented with identity lists.
The first version used hardcoded
EDIT_TOOLS/READ_TOOLSgroupings. Review correctly rejected that as brittle. The eventual fix moved permission identity andmutatesinto tool metadata and derived the read-only deny set from the registry. Future implementations should start from the metadata contract instead of introducing a second source of truth.allowCommitwas initially stronger in prose than in enforcement.The implementation evolved through several rounds of commit-form matching and eventually had to clarify the distinction between prevention and post-hoc detection. The final contract became: known commit forms are denied up front; a HEAD change is a bypass detector and marks the result unverified. Future work must specify this boundary explicitly rather than treating a post-hoc check as a permission mechanism.
The result contract initially claimed more than the implementation could observe.
changedFilesimplied an exhaustive workspace diff, while the implementation only observed files touched through specific file-editing tools. This was eventually renamed toobservedFilesand documented honestly. Future work should choose an observation model first: either take an actual before/after workspace snapshot, or explicitly expose tool-observed mutations. Do not call the latterchangedFiles.Too much behavior was validated at the unit layer before the real runner path was covered.
The later review forced a real runner-level delegation integration suite: a live child mutates a fixture, read-only writes are blocked, and timeout cancels a live child. That is the right level for this feature. Future attempts should build the end-to-end contract test early, then add unit tests only for deterministic helpers.
The implementation accumulated scope while already under review.
The commit history shows repeated review-driven hardening: permission metadata, validation ordering, topology rules, result extraction, typed
ToolFailure, and more. Each individual correction was reasonable, but together they turned the PR into a large moving target. The final branch had 2,441 additions across 38 files for an issue whose central invariant can be expressed much more narrowly. citeturn24file0turn27file0Why it was closed
There is no separate review submission explaining a single fatal technical blocker: GitHub reports the PR as closed/unmerged, and its formal review collection is empty. citeturn24file0turn28file0 The evidence instead points to scope and convergence failure: a large architectural PR accumulated multiple rounds of corrective commits and was ultimately abandoned rather than merged.
Rules for the next attempt
Do not resurrect #132 wholesale. Re-implement #99 from the contract outward.
work → codeandcode → work.--agent/positional → configured default → inference).Bottom line: #132 was not killed by one catastrophic bug. It was killed by trying to land the entire architecture in one pass, then repeatedly widening the implementation to satisfy review. The next PR should be substantially smaller, contract-first, and integration-tested from the beginning.