feat(ce-work-beta): add beta Codex delegation mode (#476)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trevin Chow
2026-04-09 00:29:12 -07:00
committed by GitHub
parent 044a035e77
commit 31b0686c2e
15 changed files with 1549 additions and 1889 deletions

View File

@@ -87,6 +87,150 @@ describe("ce:work review contract", () => {
expect(beta).not.toContain("Tests pass (run project's test command)")
expect(beta).not.toContain("- All tests pass")
})
test("ce:work remains the stable non-delegating surface", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work/SKILL.md")
expect(content).not.toContain("## Argument Parsing")
expect(content).not.toContain("## Codex Delegation Mode")
expect(content).not.toContain("delegate:codex")
})
})
describe("ce:work-beta codex delegation contract", () => {
test("has argument parsing with delegate tokens", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work-beta/SKILL.md")
// Argument parsing section exists with delegation tokens
expect(content).toContain("## Argument Parsing")
expect(content).toContain("`delegate:codex`")
expect(content).toContain("`delegate:local`")
// Resolution chain present
expect(content).toContain("### Settings Resolution Chain")
expect(content).toContain("work_delegate")
expect(content).toContain("config.local.yaml")
})
test("argument-hint includes delegate:codex for discoverability", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work-beta/SKILL.md")
expect(content).toContain("argument-hint:")
expect(content).toContain("delegate:codex")
})
test("remains manual-invocation beta during rollout", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work-beta/SKILL.md")
expect(content).toContain("disable-model-invocation: true")
expect(content).toContain("Invoke `ce:work-beta` manually")
expect(content).toContain("planning and workflow handoffs remain pointed at stable `ce:work`")
})
test("SKILL.md has delegation routing stub pointing to reference", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work-beta/SKILL.md")
expect(content).toContain("## Codex Delegation Mode")
expect(content).toContain("references/codex-delegation-workflow.md")
// Delegation details are NOT in SKILL.md body — they're in the reference
expect(content).not.toContain("### Pre-Delegation Checks")
expect(content).not.toContain("### Prompt Template")
expect(content).not.toContain("### Execution Loop")
})
test("delegation routing gate in Phase 1 Step 4", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work-beta/SKILL.md")
const gateIdx = content.indexOf("Delegation routing gate")
const strategyTableIdx = content.indexOf("| **Inline**")
expect(gateIdx).toBeGreaterThan(0)
expect(gateIdx).toBeLessThan(strategyTableIdx)
expect(content).toContain("Codex delegation requires a plan file")
})
test("delegation branches in Phase 2 task loop", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work-beta/SKILL.md")
expect(content).toContain("If delegation_active: branch to the Codex Delegation Execution Loop")
})
test("delegation reference has all required sections", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work-beta/references/codex-delegation-workflow.md")
// Pre-delegation checks
expect(content).toContain("## Pre-Delegation Checks")
expect(content).toContain("Platform Gate")
expect(content).toContain("CODEX_SANDBOX")
expect(content).toContain("command -v codex")
expect(content).toContain("Consent Flow")
// Batching
expect(content).toContain("## Batching")
// Prompt template
expect(content).toContain("## Prompt Template")
expect(content).toContain("<task>")
expect(content).toContain("<constraints>")
expect(content).toContain("<output_contract>")
expect(content).toContain("the orchestrator will not re-run verification independently")
// Result schema and execution loop
expect(content).toContain("## Result Schema")
expect(content).toContain("## Execution Loop")
expect(content).toContain("codex exec")
// Circuit breaker
expect(content).toContain("consecutive_failures")
expect(content).toContain("3 consecutive failures")
// Rollback safety
expect(content).toContain("git diff --quiet HEAD")
expect(content).toContain("git checkout -- .")
expect(content).toContain("Do NOT use bare `git clean -fd` without path arguments")
// Mixed-model attribution
expect(content).toContain("## Mixed-Model Attribution")
})
test("delegation reference has decision prompts for ask mode", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work-beta/references/codex-delegation-workflow.md")
expect(content).toContain("## Delegation Decision")
expect(content).toContain("work_delegate_decision")
expect(content).toContain("Execute with Claude Code instead")
expect(content).toContain("Delegate to Codex anyway")
expect(content).toContain("the cost of delegating outweighs having Claude Code do them")
})
test("settings resolution includes delegation decision setting", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work-beta/SKILL.md")
expect(content).toContain("work_delegate_decision")
expect(content).toContain("`auto`")
expect(content).toContain("`ask`")
})
test("has frontend design guidance ported from beta", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-work-beta/SKILL.md")
expect(content).toContain("**Frontend Design Guidance**")
expect(content).toContain("`frontend-design` skill")
})
})
describe("ce:plan remains neutral during ce:work-beta rollout", () => {
test("removes delegation-specific execution posture guidance", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-plan/SKILL.md")
// Old tag removed from execution posture signals
expect(content).not.toContain("add `Execution target: external-delegate`")
// Old tag removed from execution note examples
expect(content).not.toContain("Execution note: Execution target: external-delegate")
// Planner stays neutral instead of teaching beta-only invocation
expect(content).not.toContain("delegate:codex")
})
})
describe("ce:brainstorm review contract", () => {

View File

@@ -238,11 +238,6 @@ describe("ce-review contract", () => {
const lfg = await readRepoFile("plugins/compound-engineering/skills/lfg/SKILL.md")
expect(lfg).toContain("/ce:review mode:autofix")
const slfg = await readRepoFile("plugins/compound-engineering/skills/slfg/SKILL.md")
// slfg uses report-only for the parallel phase (safe with browser testing)
// then autofix sequentially after to emit fixes and todos
expect(slfg).toContain("/ce:review mode:report-only")
expect(slfg).toContain("/ce:review mode:autofix")
})
})