From 157c7deefd4213712eea56e1c2373717c9a36acc Mon Sep 17 00:00:00 2001 From: Akiiwa <115624916+akiiwa-games@users.noreply.github.com> Date: Fri, 13 Nov 2026 19:49:26 +0800 Subject: [PATCH] agentcompass 0.2.1: a needs_visual task requires image input at every tool_operation level (#1092) Reviewed at cedd845b3. WSL (Bun 1.4.2, temp HOME): bun test in packages/agentcompass 141 pass, scripts/check.mjs agentcompass ok. Without Boolean(task.needs_visual) the new test fails; restored, 141/141. Generated files change only their Source line. --- packages/agentcompass/CHANGELOG.md | 8 +++++++- packages/agentcompass/docs/reference.md | 2 +- packages/agentcompass/package.json | 2 +- packages/agentcompass/src/candidate-eval.js | 6 ++++-- packages/agentcompass/src/catalog.js | 2 +- packages/agentcompass/src/reference-data.js | 2 +- packages/agentcompass/test/router.test.mjs | 15 +++++++++++++++ 7 files changed, 30 insertions(+), 7 deletions(-) diff --git a/packages/agentcompass/CHANGELOG.md b/packages/agentcompass/CHANGELOG.md index 919934a..5282b0f 100644 --- a/packages/agentcompass/CHANGELOG.md +++ b/packages/agentcompass/CHANGELOG.md @@ -2,6 +2,12 @@ One entry per version, newest first. This lists what a user has to know to upgrade. +## 0.2.1 - 2026-11-13 + +The engine follows AgentCompass `2844342` (v0.6.0 plus one routing rule). + +- **A `needs_visual` task requires image input at every `tool_operation` level.** Before, the image-input gate applied only at `tool_operation` 3, so a task marked `needs_visual` (or `needs_gui`) with a lower level could be routed to a model whose public data says it takes no image input. Such a model now leaves the task, and a model with no cited modality leaves automatic routing; naming it still dispatches it with the data error. Nothing to change when upgrading. + ## 0.2.0 - 2026-11-13 The engine is AgentCompass v0.6.0 (pinned at `974eb49`, the `v0.6.0` tag), ported module by module: four capability categories (`divergence`, `coding`, `aesthetics`, `tool_operation`) in place of the 6D/7D vectors and the 3D model profile, data gates, and the quota economy. The source repository compares the port with AgentCompass's `allocator.plan` on a committed sample of 1,451 rows, drawn from a grid of 58,016. How the engine scores is AgentCompass's ([technical reference](https://github.com/akiiwa-games/AgentCompass/blob/v0.6.0/docs/technical-reference.md#1-how-scoring--allocation-work)). @@ -21,7 +27,7 @@ The engine is AgentCompass v0.6.0 (pinned at `974eb49`, the `v0.6.0` tag), porte Not ported, because Magpie only routes: launching workers, harness order, and the launch side of fast mode. -The comparison with AgentCompass's `allocator.plan` and the Linux sandbox run stay in the source repository, [akiiwa-games/magpie-agentcompass-router](https://github.com/akiiwa-games/magpie-agentcompass-router); this package's tests run on their own. The sandbox script was rewritten for this engine and ran on real Magpie 0.1.4022 (2026-11-13, no real sign-in): scenarios 1–10, 12, 14 and 15 passed; scenario 13, against real upstream accounts, was not run. The record is `docs/linux-sandbox-e2e-report-0.1.4022.json` there. +The comparison with AgentCompass's `allocator.plan` and the Linux sandbox run stay in the source repository, [akiiwa-games/magpie-agentcompass-router](https://github.com/akiiwa-games/magpie-agentcompass-router); this package's tests run on their own. The sandbox script was rewritten for this engine and ran on real Magpie 0.1.4026 (2026-11-13) with real Codex and Claude sign-ins: scenarios 1–10 and 12–15 passed, scenario 13 against both real upstreams included (no `profile` on the wire, the routes the engine gives, a real classifier, one valid account among invalid peers, every account unavailable). The record is `docs/linux-sandbox-e2e-report-0.1.4026.json` there. ## 0.1.6 - 2026-11-08 diff --git a/packages/agentcompass/docs/reference.md b/packages/agentcompass/docs/reference.md index d5e8b9a..fcbd3f1 100644 --- a/packages/agentcompass/docs/reference.md +++ b/packages/agentcompass/docs/reference.md @@ -192,4 +192,4 @@ Magpie prefixes pool strategies with the package name (without its scope and a ` bun test # or: npm test ``` -The tests run on their own: no AgentCompass checkout and no network. They are the rules (`router`, `routing-contract`, `no-hardcode`) and the quota and plan tests (`plan-state`, `plan-align`, `quotas-load`). The comparison with AgentCompass's `allocator.plan` (same winner, effort and score on a grid of profiles and pools) and the sandbox run against real Magpie builds stay in the source repository, [akiiwa-games/magpie-agentcompass-router](https://github.com/akiiwa-games/magpie-agentcompass-router). The record of the sandbox run for the v0.6.0 engine, on Magpie 0.1.4022 and Bun 1.4.4, is [`docs/linux-sandbox-e2e-report-0.1.4022.json`](https://github.com/akiiwa-games/magpie-agentcompass-router/blob/main/docs/linux-sandbox-e2e-report-0.1.4022.json): scenarios 1–10, 12, 14 and 15 passed; scenario 13, against real upstream accounts, was not run. +The tests run on their own: no AgentCompass checkout and no network. They are the rules (`router`, `routing-contract`, `no-hardcode`) and the quota and plan tests (`plan-state`, `plan-align`, `quotas-load`). The comparison with AgentCompass's `allocator.plan` (same winner, effort and score on a grid of profiles and pools) and the sandbox run against real Magpie builds stay in the source repository, [akiiwa-games/magpie-agentcompass-router](https://github.com/akiiwa-games/magpie-agentcompass-router). The record of the sandbox run for the v0.6.0 engine, on Magpie 0.1.4026 and Bun 1.4.4, is [`docs/linux-sandbox-e2e-report-0.1.4026.json`](https://github.com/akiiwa-games/magpie-agentcompass-router/blob/main/docs/linux-sandbox-e2e-report-0.1.4026.json): scenarios 1–10 and 12–15 passed, scenario 13 with real Codex and Claude sign-ins included. diff --git a/packages/agentcompass/package.json b/packages/agentcompass/package.json index f699ee9..e346151 100644 --- a/packages/agentcompass/package.json +++ b/packages/agentcompass/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/gateway-agentcompass", - "version": "0.2.0", + "version": "0.2.1", "description": "Four-category capability fit, quota-economy and session-affinity routing plugin for Magpie, powered by AgentCompass v0.6.0.", "type": "module", "main": "./src/index.js", diff --git a/packages/agentcompass/src/candidate-eval.js b/packages/agentcompass/src/candidate-eval.js index f7d8fc8..a9a7ab0 100644 --- a/packages/agentcompass/src/candidate-eval.js +++ b/packages/agentcompass/src/candidate-eval.js @@ -305,13 +305,15 @@ export function evaluateBundle(bundle, task, ctx) { if (namedBundle && ![bundle.id, bundle.source_id, bundle.pin_carrier].includes(namedBundle)) taskExclude(EXPLICIT_BUNDLE_CONSTRAINT); // Rule B: a demanded category with no data at all, no cited usd on a metered account, or unknown image_input modality when - // the task demands image input (tool_operation 3), leaves automatic routing; naming the model still dispatches it, with the + // the task demands image input (needs_visual, or tool_operation 3), leaves automatic routing; naming the model still dispatches it, with the // data error as a warning and its cost unpriced. const state = info.five_axis || { missing: [...FIVE_AXES], usd_status: "missing" }; const billed = !(spec.unmetered || spec.unlimited); const named0 = !pool && (modelPinMatches(task, bundle, ownModel) || task.pinned_bundle === bundle.id); const imgInfo = state.image_input || { status: "missing" }; - const needsImageInput = (task.five_axis_demand.tool_operation || 0) >= IMAGE_INPUT_LEVEL && !pool; + // The task reads images when the classifier says so (needs_visual, which task intake also sets for needs_gui) or when it + // demands tool_operation 3: a model that takes no image input cannot do either. + const needsImageInput = (Boolean(task.needs_visual) || (task.five_axis_demand.tool_operation || 0) >= IMAGE_INPUT_LEVEL) && !pool; const eff = scoringEffort(bundle, info); const values = fiveAxisValues(state, eff); if (needsImageInput && imgInfo.status === "no") exclude(`model does not accept image input (${imgInfo.source || "public data"})`); diff --git a/packages/agentcompass/src/catalog.js b/packages/agentcompass/src/catalog.js index 164a3d6..0440de5 100644 --- a/packages/agentcompass/src/catalog.js +++ b/packages/agentcompass/src/catalog.js @@ -17,7 +17,7 @@ export const DIFFICULTY_ORDER = ["routine", "hard", "coupled", "frontier"]; export const EFFORT_ORDER = ["low", "medium", "high", "xhigh", "max", "ultra"]; // BEGIN GENERATED by scripts/sync-catalog.mjs -// Source: AgentCompass 974eb49009a34687887cb3d4253391ad8efcf304 skills/agent-compass/references/accounts.json, skills/agent-compass/references/plan-templates.json +// Source: AgentCompass 28443426409fe456a63c2b63633faf18e97ee7b4 skills/agent-compass/references/accounts.json, skills/agent-compass/references/plan-templates.json export const MODELS = { "deepseek-v4.1-flash-free": {}, diff --git a/packages/agentcompass/src/reference-data.js b/packages/agentcompass/src/reference-data.js index 09d0bbf..f3473e2 100644 --- a/packages/agentcompass/src/reference-data.js +++ b/packages/agentcompass/src/reference-data.js @@ -1,5 +1,5 @@ // GENERATED by scripts/sync-catalog.mjs: do not edit; run `npm run catalog:sync`. -// Source: AgentCompass 974eb49009a34687887cb3d4253391ad8efcf304 skills/agent-compass/references/five-axis-scores.json, skills/agent-compass/references/user-scores.json +// Source: AgentCompass 28443426409fe456a63c2b63633faf18e97ee7b4 skills/agent-compass/references/five-axis-scores.json, skills/agent-compass/references/user-scores.json // The category scores, panel targets, durations, plan capacities and maintainer manual scores the allocator reads. export const FIVE_AXIS_SCHEMA = "agent-compass.five-axis-scores/3"; diff --git a/packages/agentcompass/test/router.test.mjs b/packages/agentcompass/test/router.test.mjs index 38dbb3f..ea9915d 100644 --- a/packages/agentcompass/test/router.test.mjs +++ b/packages/agentcompass/test/router.test.mjs @@ -128,6 +128,21 @@ test("image input is a gate at tool_operation level 3: no model without it, none assert.ok(ranked.allCandidates.some((c) => !c.eligible && c.excluded.some((e) => /image/i.test(e)))); }); +test("needs_visual is a required modality at every tool_operation level: the same image-input gate applies", () => { + for (const level of [0, 2]) { + const ranked = rank(profile({ needs_visual: true, axis_demand: { tool_operation: level } })); + assert.ok(ranked.ranking.length > 0, `level ${level}`); + for (const c of ranked.ranking) { + const info = defaultScoredModels()[catalog.resolveModel(c.model).key] || {}; + assert.equal(((info.five_axis || {}).image_input || {}).status, "yes", `${c.id} at level ${level}`); + } + assert.ok(ranked.allCandidates.some((c) => !c.eligible && c.excluded.some((e) => /model does not accept image input/.test(e))), `level ${level}`); + } + // Without the flag, below level 3, no candidate leaves for modality. + const plain = rank(profile({ needs_visual: false, axis_demand: { tool_operation: 2 } })); + assert.ok(!plain.allCandidates.some((c) => c.excluded.some((e) => /image.input/i.test(e)))); +}); + test("a profile the schema does not hold is refused, not routed", () => { for (const bad of [{ axis_demand: { coding: 4 } }, { axis_demand: { coding: 2, speed: 1 } }, { access: "workspace-write" }, { reasoning_depth: 9 }]) { const d = selectBestRoute({ ...P, ...bad }, { candidateModels: ["gpt-6.1-sol"], now: T0 });