Repository navigation
fix(certification): route si_* tools proactively to /si tenant - #7512
garvitkaushik-123 merged 4 commits into
Conversation
The reactive sibling-switch in formatTenantBlock relied on matching "Unknown tool" in error responses to trigger a tenant switch. JSON-RPC errors and adcp_error-wrapped responses don't match that pattern, so si_initiate_session never reached the /si tenant — blocking C3 module completion entirely. Replace the reactive fallback with a proactive per-tool routing table built from TOOL_CATALOG. Each tool call is now sent directly to its owning tenant URL at session start, eliminating the error round-trip. Closes adcontextprotocol#7483
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean, correctly-targeted routing fix.
What I checked:
- No findings at any severity (no critical/high/medium/low). Decision table rows 1, 4, 5, 6, 8 do not fire.
gated_paths: false— row 2 does not apply despitereview_decision: REVIEW_REQUIRED.high_risk: trueonly viaserver/src/addie/mcp/certification-tools.ts (modified)matchingserver/src/addie/**. Per the high-risk-flag reading, a(modified)file with no medium-or-higher finding is presumed safe — rows 3 and 5 do not fire (no deletion, no medium).- No no-auto-approve team match (row 7 clears).
- App/Addie-only change: no
static/schemas/source/**, nodocs/reference/**, nodist/**, no migrations touched — none of the mandatory schema/docs/changeset/oneOf/immutability/patch-eligibility gates apply. No changeset needed for an Addie-only change. - The fix replaces a brittle reactive "unknown tool" string match with a proactive {url → tools[]} routing table from TOOL_CATALOG; reviewer verified primary-preference logic, deterministic output, parallel-array alignment, and that the session-based SI flow keeps si_initiate_session/si_send_message on /si.
Falls through to row 9 → approve.
Non-blocking note: end-to-end C3 completion on staging is unchecked in the test plan; LLM-routing ships validated at the string-builder level only. Recommend a manual smoke before merge, but this is not a blocking finding.
Avoids CodeQL js/incomplete-hostname-regexp alert caused by interpolating a dotted hostname into a RegExp without escaping. The toContain assertions are equally precise for this test.
b55d76a
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — routing refactor to formatTenantBlock is sound.
This PR replaces the reactive sibling-switch in formatTenantBlock with a proactive per-tool routing table built from TOOL_CATALOG (server/src/addie/mcp/certification-tools.ts) plus a test update. Changes are Addie/Sage server code, not the published protocol surface (no static/schemas/source/**, docs/reference, dist artifacts, or version edits), so no changeset is required and none of the spec-drift / immutability / oneOf / 3.1.x gates apply.
Gate checks:
- gated_paths: false; review_decision: APPROVED — no path gate blocks.
- No no-auto-approve team match.
- high_risk: true only via
(modified)match onserver/src/addie/**; not a deletion, and no medium-or-higher finding on that file, so row 5 does not fire.
Medium findings
- server/tests/unit/training-agent-config-tenant-urls.test.ts — the new si_* routing test's negative assertion matches the agent_url primary declaration line rather than the creative routing line, making the guard vacuous. Worth fixing but the reviewer recorded it as a note (not in the actionable findings list) and it does not block.
With no critical/high findings, no escalation trigger, and fewer than three medium findings, this falls through to the approve row.
db46cac
Summary
si_initiate_sessionnever reached the/sitenantformatTenantBlock()used a reactive sibling-switch that pattern-matched"Unknown tool"in error strings, but JSON-RPC errors andadcp_error-wrapped responses never match that patternTOOL_CATALOG— each tool call now goes directly to its owning tenant URL at session start, no error round-trip neededWhat changed
certification-tools.ts:formatTenantBlock()now builds a{url → tools[]}routing block fromTOOL_CATALOGfor multi-tenant modules instead of emitting sibling-switch instructionstraining-agent-config-tenant-urls.test.ts: Updated existing multi-tenant test to assert proactive routing; added C3-specific test confirmingsi_initiate_sessionroutes to/siTest plan
vitest run server/tests/unit/training-agent-config-tenant-urls.test.ts— all 10 tests passCloses #7483