Repository navigation
feat(evals): add a delegation-accuracy trajectory case - #230
Conversation
|
Warning Review limit reachedNext included review available in 27 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: ⛔ Files ignored due to path filters (7)
📒 Files selected for processing (16)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk
Adds loom-delegates-backend-fix-to-category-trajectory (Spec 37, 20.1), the first of three runtime behaviour cases from the September session audit. It stands in for the Delegations, Configuration delegation failures, Built-in agent delegations and Category-shuttle success metrics. The orders-api fixture declares backend and frontend categories. The user reports that `GET /orders/:id` returns 200 with a null body. Loom must delegate to the shuttle-backend category shuttle and nothing else, and shuttle-backend must then edit the code. The existing schema could not express that promise. `expected_spawns` checks an exact ordered sequence, and under the Spec 33 pass rule a matching sequence passes even when the spawned agent then failed. So the smallest extension is one optional field, `allowed_delegates`. It is one execution check, and like expected_commands it gates the pass. The check requires at least one spawn, every spawned sub-agent in the list, and a code edit by one of them. The edit is taken from the observer's per-agent records, and it proves that the delegated agent's model resolved. Two runner tests that run the real loom-routing corpus live now pass `track: "text"`. The new case allows claude-sonnet-4.5, so without it they would start a Podman sandbox. Live run (DeepSeek V4 Flash, 1 run): pass. Loom read the code and delegated once to shuttle-backend, which edited src/api/orders.ts and ran bun test. No other sub-agent was spawned. Cost < $0.01. Refs #183 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk
15dfb32 to
0a47324
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Delegation validation and successful, spawned-agent edit attribution are not yet fully enforced.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds a delegation-accuracy trajectory evaluation, including the allowed_delegates schema, scoring logic, tests, fixture, documentation, and workflow updates.
Changes:
- Adds the
orders-apievaluation fixture and delegation case. - Extends schema validation and trajectory scoring.
- Adds tests, rubric metadata, documentation, and allowlist updates.
- Delegation attribution and edit verification require changes before approval.
| File | Reviewed changes |
|---|---|
packages/cli/src/evals/types.ts |
Adds allowed_delegates schema support. |
packages/cli/src/evals/trajectory-scoring.ts |
Scores delegation restrictions and delegate edits; changes required for validation and edit attribution. |
packages/cli/src/evals/__tests__/types.test.ts |
Tests schema validation. |
packages/cli/src/evals/__tests__/trajectory-scoring.test.ts |
Tests delegation scoring scenarios. |
packages/cli/src/evals/__tests__/runner.test.ts |
Updates runner tests to use the text track. |
evals/rubrics/loom-routing/loom-delegates-backend-fix-to-category-trajectory.json |
Adds rubric metadata. |
evals/README.md |
Documents the new case and fixture. |
evals/fixtures/orders-api/test/orders.test.ts |
Adds fixture tests. |
evals/fixtures/orders-api/src/ui/order-badge.ts |
Adds fixture UI code. |
evals/fixtures/orders-api/src/db/orders.ts |
Adds fixture database code. |
evals/fixtures/orders-api/src/api/orders.ts |
Adds fixture API code. |
evals/fixtures/orders-api/package.json |
Defines fixture package configuration. |
evals/fixtures/orders-api/.weave/config.weave |
Adds fixture Weave configuration. |
evals/cases/loom-routing/loom-delegates-backend-fix-to-category-trajectory.json |
Defines the delegation trajectory case. |
docs/specs/37-spec-repository-foundation/37-tasks-repository-foundation.md |
Updates task tracking. |
docs/specs/35-spec-verification-trajectory-evals/35-spec-verification-trajectory-evals.md |
Documents the runtime verification check. |
docs/agent-evals.md |
Documents runtime behavior coverage. |
.github/workflows/agent-evals.yml |
Updates evaluation allowlists. |
.codesight/CODESIGHT.md |
Updates generated metadata. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
An edit attributed to an allowed agent that was never spawned no longer satisfies the check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk
| const editedByDelegate = codeEdits(events).some((event) => | ||
| spawnedDelegates.has(event.agentName), | ||
| ); |
| * of them made a code edit, so the delegation reached a working agent. | ||
| * Like `expected_commands`, it gates the pass. | ||
| */ | ||
| allowed_delegates: z.array(IdentifierSchema).min(1).optional(), |
…ry rules
Spec 38 item 3 (root causes c and e), written as the behaviour wanted:
- loom.md and tapestry.md: "Delegate only to the agents listed above."
The example names (shuttle-backend, shuttle-frontend, shuttle-core) and
the shuttle-{category} placeholder are gone; specialists are referred to
by role or through the rendered delegation list, so a disabled agent
such as warp is no longer named.
- loom.md: the size rule. Loom does small, self-contained work itself and
delegates work that spans several files, needs exploration, needs a
plan, or is a review. It replaces "Small or self-contained work",
"Delegate aggressively" and "Never delegate work you can complete
correctly in one step".
- loom.md and tapestry.md: the recovery rule. Resend once after a
transient error; after a configuration error send the task to shuttle
and tell the user which agent is broken. Tapestry's retry is folded in.
- Copilot: drop the placeholder rewrite; the appended section points to
"the matching category shuttle listed above". Bundle regenerated.
- Delegation contract: the item-3 it.failing assertions are plain it,
except where item 2 is still needed. Guard tests assert the new
sentences.
- #230 trajectory case now spans the handler and the data layer, since a
one-file fix is work the size rule lets Loom do itself.
Refs #253
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk
Tick group 3 in the Spec 38 tasks file with the wording decisions, the agents" rule in prompt-composition.md, and bring the Copilot adapter doc, the L2 notes in testing-strategy.md and the #230 row in agent-evals.md in line with the new prompts. Refs #253 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk
…(Spec 38 item 3) (#257) * feat(prompts): give Loom and Tapestry the delegation, size and recovery rules Spec 38 item 3 (root causes c and e), written as the behaviour wanted: - loom.md and tapestry.md: "Delegate only to the agents listed above." The example names (shuttle-backend, shuttle-frontend, shuttle-core) and the shuttle-{category} placeholder are gone; specialists are referred to by role or through the rendered delegation list, so a disabled agent such as warp is no longer named. - loom.md: the size rule. Loom does small, self-contained work itself and delegates work that spans several files, needs exploration, needs a plan, or is a review. It replaces "Small or self-contained work", "Delegate aggressively" and "Never delegate work you can complete correctly in one step". - loom.md and tapestry.md: the recovery rule. Resend once after a transient error; after a configuration error send the task to shuttle and tell the user which agent is broken. Tapestry's retry is folded in. - Copilot: drop the placeholder rewrite; the appended section points to "the matching category shuttle listed above". Bundle regenerated. - Delegation contract: the item-3 it.failing assertions are plain it, except where item 2 is still needed. Guard tests assert the new sentences. - #230 trajectory case now spans the handler and the data layer, since a one-file fix is work the size rule lets Loom do itself. Refs #253 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk * docs(spec-38): record the group 3 prompt rules and their measurement Tick group 3 in the Spec 38 tasks file with the wording decisions, the agents" rule in prompt-composition.md, and bring the Copilot adapter doc, the L2 notes in testing-strategy.md and the #230 row in agent-evals.md in line with the new prompts. Refs #253 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk * fix(prompts): keep Loom's category-shuttle sentence free of agent names "its entry in the list above describes that area" contained the substring "scribe", which the OpenCode 2 name-collision scenario from item 2 reads as Loom still naming another plugin's `scribe` agent. Reword it to "says which area it covers" and regenerate the Copilot bundle. Refs #253 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk * docs(spec-38): record the tapestry-category-routing re-measurement After #259 composed each case's categories into Tapestry's list, the group 3 prompts show no change beyond the noise on the suite (DeepSeek 30/30 -> 29/30, GPT 6 Luna 30/30 -> 30/30, --models dev --repeat 3). Refs #253 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>


Refs #183 (Spec 37, task 20.1: delegation accuracy, the first of three runtime behaviour cases)
What
loom-delegates-backend-fix-to-category-trajectory(loom-routing,harness_trajectory,opencode-local, starts on Loom). It uses the new fixtureevals/fixtures/orders-api, a small Bun project withbackendandfrontendcategories. The user reports, in plain words, thatGET /orders/:idreturns 200 with anullbody. Loom must delegate to theshuttle-backendcategory shuttle and to nothing else, andshuttle-backendmust then edit the code.explore/general) and Category-shuttle success. The rubric notes and the new "Runtime behaviour cases" table indocs/agent-evals.mdboth name them.allowed_delegates(documented in Spec 35 under "Runtime behaviour checks (Spec 37, task 20.1)"). It was needed becauseexpected_spawnschecks an exact ordered sequence, and under the Spec 33 pass rule a matching sequence passes the case even when the spawned agent then failed. With a verifier, the case would also pass when Loom did the work itself.allowed_delegatesis one execution check. It requires at least one spawn, every spawned sub-agent in the list, and a code edit made by one of them. The edit comes from the observer's per-agent records and proves the delegated agent's model resolved. Likeexpected_commands, it gates the pass. The adapter and the publishable surface are unchanged. Tests: schema (types.test.ts), scoring (trajectory-scoring.test.ts: happy path, a built-in delegation next to a good one, Loom doing the work itself, a delegate that never edits, a bookkeeping-only edit), and the full pipeline throughworkflow-sync.test.ts, which loads every real case.runner.test.tstests run the real loom-routing corpus live with stubs. They now passtrack: "text". The new case allowsclaude-sonnet-4.5, so without it they started real Podman containers (with a fake key) and timed out.ALLOWED_CASES,ALLOWED_TRAJECTORY_CASES),evals/README.mdand the tasks file are updated. 20.1 stays unticked until all three cases land.Live run
One run,
deepseek/deepseek-v4-flash-0731,--raw-artifacts(raw files not committed): PASS, weighted total 1.00. Loom grepped and read the code, then delegated once toshuttle-backend.shuttle-backendeditedsrc/api/orders.ts(and the test file) and ranbun test(exit 0). Noexplore/generalor other sub-agent was spawned. Cost < $0.01 (OpenRouter usage 110.9131 → 110.9170).This is the baseline for the delegation-accuracy case. On
main, with the category-model fix (b4f8efac), the category shuttle resolves and Loom routes to it.🤖 Generated with Claude Code
https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk