Skip to content

docs: add a routing canary for Skill activation evidence - #402

Merged
zpzjzj merged 13 commits into
alibaba:mainfrom
Walternater:docs/routing-canary
Nov 25, 2026
Merged

zpzjzj merged 13 commits into
alibaba:mainfrom
Walternater:docs/routing-canary

Conversation

@Walternater

@Walternater Walternater commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #166

Summary

First milestone of #166: an executable, repeatable engine capability investigation
through a real repository fixture. No SkillActivation type, no capability flag
and no catalogue claim — only what the transcript evidence supports.

Evidence rules

  • A tool call counts only when the transcript shows the tool name and its
    payload; prose like "There are no available skills" does not.
  • A SKILL.md path inside a call or a result counts as a reference, which is
    deliberately weaker than "read": a directory listing or a failed cat also
    contains SKILL.md.
  • The injected Skill catalogue counts only in a system or developer message.
  • A null-only or empty transcript reports empty; a line that did not decode
    reports incomplete; a transcript reporting an OpenCode error event or a
    Claude Code result event flagged is_error reports failed. In all three
    cases unobserved evidence is reported as unknown (-) instead of absent.
  • Observed evidence produced before a failure or an incomplete tail is kept.

Changes

  • scripts/routing-canary/run.sh — per-engine fixture, quarantined config
    roots, output kept under out/<engine>/, summary generated after the run.
  • scripts/routing-canary/summarize.py — evidence table with execution status
    from result.json kept separate from transcript availability; failed-run
    detection for the two shapes the adapters already read.
  • scripts/routing-canary/test_summarize.py — offline fixtures for all the
    rules above, including the OpenCode error-event fixture from
    internal/agent/opencode_test.go.
  • examples/routing-canary/ — the fixture repository and its README.
  • docs/design/routing-canary.md — what the evidence means and how to read the
    summary; the transcript-state table now lists failed.

Validation

  • python3 -m unittest discover -s scripts/routing-canary -p "test_*.py" — 14
    tests pass locally and in CI.
  • go test ./internal/agent/... — existing adapter tests pass; the error-event
    fixture is reused as an offline summarizer test, so no live engine is needed.

Limitations

  • Engine skill roots are only quarantined when the operator sets the documented
    environment variables; CODEX_HOME alone does not remove ~/.agents/skills.
  • A reference is not proof of a read, and the report deliberately says so.
  • No live engines were rerun for the failure-handling follow-up; only the
    offline fixtures were added.

This PR was prepared with DeepSeek Harness (deepseek-v4.1-flash); the investigation runs used the engine CLIs installed on the author's machine. The follow-up commits, including the failed-run handling in ab67b68, were prepared with Codex.

Disclosure

This PR was written with AI assistance: DeepSeek Harness (deepseek-v4.1-flash)
produced the original investigation and Codex prepared the follow-up commits.
wangchongfei reviewed every line and approved each commit before it was pushed.
This is stated here and on the account profile because a maintainer should know
who — and what — they are reviewing.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T09:33:32.023680Z 6330386 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6330386947

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/routing-canary/run.sh Resolved
Comment thread scripts/routing-canary/run.sh Resolved

zpzjzj commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Two additional points in scripts/routing-canary/summarize.py, beyond the existing connector findings:

  1. Please keep cases with missing transcripts in the summary instead of silently dropping them. Show the execution status from result.json alongside an explicit “transcript missing” state, so missing evidence is not confused with no activation.

  2. reads SKILL.md currently means only that a tool-call payload contains that string. A listing or a failed cat would also produce “yes”. For a schema-agnostic summary, labeling this as a reference or read attempt would be more accurate. Confirmed reads would require checking the corresponding tool result.

Small fixture tests for these cases would help keep the evidence summary reliable.

@Walternater

Copy link
Copy Markdown
Contributor Author

Addressed in 3d6701b:

Summarizer (review points 1–2)

  • Cases whose transcript is missing are kept, with the execution status from the iteration result.json and an explicit transcript: missing column. Cases present in result.json but absent from disk are kept too (fixture test covers ERROR + missing transcript).
  • The old reads SKILL.md column is now skill file reference. It only means a tool-call payload contains SKILL.md; a listing or failed cat also matches, and the doc column table says so explicitly. Confirming a read needs the paired tool result, which is engine specific and out of scope for the schema-agnostic summary.
  • New scripts/routing-canary/test_summarize.py (3 fixture tests: missing transcript with ERROR, listing-only reference, transcript without result.json).

run.sh (connector P2s)

  • Engine failures are accumulated; the script exits nonzero with FAILED: <engines> after processing the remaining engines.
  • out/<engine>/ is replaced before copying instead of overlaid, so a later ITERATIONS=1 run cannot be summarized with stale iteration-2/ data.
  • A failed summary also counts as a failure.
  • Verified locally: real claude_code run exits 0 with 3/3 PASS and the new columns; run.sh not_an_engine exits 1 and removes the stale out/not_an_engine/iteration-9.

python3 -m unittest scripts/routing-canary/test_summarize.py passes; bash -n and npm run docs:build pass.

@Walternater

Copy link
Copy Markdown
Contributor Author

Three-iteration stability data in f609285, plus one fixture fix the runs forced.

Method: ITERATIONS=3 scripts/routing-canary/run.sh <engine>; each iteration runs all three cases in a fresh workspace. Claude Code 2.1.317 and codex 0.166.0 (isolated CODEX_HOME), both environment.type: none.

Engine relevant unrelated competing
claude_code 3/3 PASS 3/3 PASS 1/3 PASS
codex 3/3 PASS 3/3 PASS 3/3 PASS

Two things worth separating rather than averaging:

  1. Claude Code routed 9/9 but obeyed 7/9. Every competing transcript contains Skill {"skill": "translator"} and the engine's Launching skill: translator result, so the routing decision was stable. But only iteration 1 also wrote .translation-done; in iteration 3 the model translated the line and then explained that it did not follow the marker instruction because the instruction looked artificial. Loading a Skill and obeying it are different measurements, and the marker conflates them on a request that is answerable without the Skill.
  2. The fixture name leaked the answer. The old name canary-decoy was visible in the catalog; one run answered that it was "a canary/decoy entry rather than a real translation skill" and skipped it. The second Skill is now literary-translation writing .translation-done (canary-routing stays in the code-word arm, where a neutral name would defeat the point).

Also changed: summarize.py follows the new marker; the report has the per-iteration table, a stability section, and two new confounders (application compliance where the task is natively answerable; experiment names leaking intent). npm run docs:build and the summarizer unit tests pass.

OpenCode is still unmeasured: it refuses the user-level config (V2 permissions are not supported by OpenCode V1), so it needs an isolated config directory before it can appear in this table.

@Walternater

Copy link
Copy Markdown
Contributor Author

OpenCode is now measured, and the summary parses its event shape (644397a).

Isolation. Its user-level ~/.config/opencode/opencode.json here contains V2 permission rules that OpenCode V1 rejects (V2 permissions are not supported by OpenCode V1), so the run points XDG_CONFIG_HOME and XDG_DATA_HOME at a temporary directory with only opencode/auth.json. It also has no working default model, so the run pins one: CANARY_MODEL=opencode/deepseek-v4.1-flash-free. run.sh now accepts CANARY_MODEL and passes it as --model; the README has the exact command.

Evidence. OpenCode emits a structured tool call whose result is the Skill body:

{"type":"tool_use","part":{"type":"tool","tool":"skill","state":{"status":"completed",
  "input":{"name":"literary-translation"},
  "output":"<skill_content name=\"literary-translation\">..."}}}

Two things worth recording:

  • The call names the frontmatter name, while the Skill is installed as translator. That is the opposite of Claude Code in this fixture, which named the install directory. A capability flag has to state which identity it records.
  • This shape is why the summarizer showed - for OpenCode at first: the name is in part.tool and the arguments in part.state.input, not on one object like Claude Code/Codex. tool_calls now reads both layouts, with a unit test for the nested shape. That is the "does not depend on a single schema" claim actually holding.

Results (3 iterations).

Engine Relevant Unrelated Competing
opencode 3/3 PASS 3/3 PASS 1/3 PASS

The competing misses are the same confounder already documented for Claude Code, not a routing miss: the transcript has the skill call for literary-translation in all three iterations, but in two the model translated directly and said the marker instruction "is not a translation workflow". Routing evidence present, application evidence absent — the reason recommendation 4 keeps those as separate assertions.

The matrix row, results table and the remaining OpenCode limitation are updated in docs/design/routing-canary.md.

@Walternater

Copy link
Copy Markdown
Contributor Author

#402 (comment)

zpzjzj commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the update. The OpenCode section formatting looks fixed. A few items remain:

  • Please validate engine against the supported names before using it in paths. It currently reaches rm -rf, and ${artifacts:?} does not prevent traversal through ../.
  • Please wire test_summarize.py into CI. The current green checks do not cover these fixture tests.
  • Please sync the PR description with the latest report: OpenCode has now been tested, and canary-decoy has been renamed to literary-translation.

@Walternater

Copy link
Copy Markdown
Contributor Author

Fixed the three review points on the scripts (644397a → d6bbdc5):

  1. Engine whitelist before any filesystem work — scripts/routing-canary/run.sh now checks each engine argument against claude_code codex opencode and exits with unsupported engine: X (supported: ...) before building, copying, or deleting anything, so a traversal-style argument can no longer reach rm -rf. Negative test: run.sh ../evil exits 1 and touches nothing.
  2. Fixture-script tests in CI — .github/workflows/ci.yml lint job gains a python3 -m unittest discover -s scripts/routing-canary -p "test_*.py" step, so the summarizer tests run on every push/PR (verified locally: 3 tests, OK; CI YAML parses).
  3. PR description synced — OpenCode marked as measured (isolated XDG dirs + pinned model, nested tool-call shape) and the second Skill named as literary-translation (shipped as decoy/).

While testing the whitelist end-to-end I also hit a latent bug the review did not catch: under set -u with a POSIX bash (< 4.4), "${model_args[@]}" fails as unbound when CANARY_MODEL is unset, so a plain ``scripts/routing-canary/run.sh claude_code aborts before running. The push uses the guarded expansion ${model_args[@]+"${model_args[@]}"}. A claude_code-only run completes and the summary/failure-exit path behave as before (a genuine case failure still exits 1, as seen with the known flaky `competing` case).

zpzjzj commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

The CI wiring and updated PR description address those two items. One issue remains in the new engine allowlist: grep -qx "$engine" treats the supplied name as a regular expression, not a literal name. For example, code. or .* is accepted even though neither is a supported engine. Please use an exact shell case/array equality check (rather than a regex match) before creating the temporary workspace, and add a small runner-validation test covering unknown names, regex metacharacters and multiline input. This keeps the path guard tied to the three exact supported names.

zpzjzj commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the update. The allowlist can still be bypassed with an embedded newline: grep treats it as multiple patterns, so the codex line makes this argument pass validation:

scripts/routing-canary/run.sh $'../victim\ncodex'

The full argument then reaches rm -rf, targeting the directory named $'victim\ncodex' outside out/. I reproduced the deletion using temporary test data; please only try this in a disposable directory.

Could you replace the regex check with an exact shell case match before creating the temporary workspace?

case "$engine" in
  claude_code|codex|opencode) ;;
  *) echo "Unsupported engine: $engine" >&2; exit 1 ;;
esac

A small validation test covering unknown names, regex characters, and embedded newlines would help prevent regressions.

@zpzjzj zpzjzj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes on d6bbdc5 for the unresolved engine validation issue detailed here. grep -qx "$engine" still interprets input as patterns, while that same input reaches artifact deletion paths. Please use exact supported-name matching before filesystem operations and test unknown, regex-like, and multiline names. The CI/documentation fixes are acknowledged; this is the remaining blocker.

@Walternater

Copy link
Copy Markdown
Contributor Author

Fixed in eeebb65.

run.sh no longer matches the name against a pattern list. Validation is now a string comparison loop ([ "$candidate" = "$supported" ]) before any temporary directory is created, and the grep -qx check it replaced is gone. I checked both failure modes you named rather than assuming one replacement covers the other:

  • grep -x reads $'../victim\ncodex' as two patterns, so the codex line would have matched.
  • bash case "$engine" in claude_code|codex|opencode) without quoting the pattern treats $engine as a glob, so co* or claude* would have matched too — the snippet you suggested would still have let those through. Re-running your repro against it confirms the bypass: co* and the newline value both reach the artifact path check.

Tests (scripts/routing-canary/test_summarize.py, EngineNameValidationTest, already wired into the lint job):

  • test_rejects_unknown_pattern_and_multiline_names runs the real script for evil, co*, claude*, ../victim, $'../victim\ncodex' and "", asserting exit 1 with the supported list on stderr and that the working directory is unchanged — a sibling victim/ directory is neither deleted nor written into.
  • test_accepts_each_supported_name_syntax stubs go on PATH and checks claude_code reaches the build step, so the test cannot pass by rejecting everything.

Negative control: with d6bbdc5's run.sh restored the first test fails, and the failure shows what the old check let through — the working directory ends up with out/, victim\ncodex next to the untouched victim/.

python3 -m unittest discover -s scripts/routing-canary → 6 tests OK.

zpzjzj commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Checked eeebb65: the exact string comparison fixes the engine-name validation bypass. I also ran all six fixture-script tests successfully.

One small cleanup remains: mktemp still runs before validation, while the cleanup trap is installed afterward, so invalid arguments exit leaving an empty temporary directory behind. The six rejected-input cases left six such directories in my isolated test run. Please move mktemp after successful validation.

It would also be useful to exercise all three supported names in test_accepts_each_supported_name_syntax; currently it only checks claude_code. This is a follow-up verification comment, not an approval.

@Walternater

Copy link
Copy Markdown
Contributor Author

Both in 27ecb14.

Temp dir. mktemp now runs after the name validation (the guard sits above it), so a rejected name exits before anything is created. The rejection test now points TMPDIR at a directory of its own and asserts it is still empty afterwards; restoring the old order fails with the six routing-canary.* directories the review mentions.

All three names. test_accepts_each_supported_name_syntax loops over claude_code, codex and opencode, stubbing go so each run stops at the build step. python3 -m unittest discover -s scripts/routing-canary → 6 tests OK, bash -n clean.

zpzjzj commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the fix. The exact string comparison addresses the newline bypass, and all six tests pass locally.

Could you also sync three details in the PR description?

  • The translation Skill is installed as translator/, not decoy/.
  • The blanket “3/3 PASS” statement should reflect the latest report: Claude Code’s competing case passed only 1/3 runs.
  • OpenCode’s event shape should be part.tool / part.state.input, consistent with the report and fixture test.

@Walternater

Copy link
Copy Markdown
Contributor Author

Synced all three in the description:

  • translation Skill is translator/;
  • the test plan now reports routing 9/9 over three iterations with the competing application at 1/3 for Claude Code (and 3/3 for Codex), instead of a blanket "3/3 PASS";
  • OpenCode's events are described as part.tool / part.state.input.

Also folded in the earlier fix: mktemp now runs after the engine-name check (the rejection test asserts no temp dir is left), and the acceptance test covers claude_code, codex and opencode.

zpzjzj commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks for updating the PR description. I reran the six offline tests and they all passed. Could you clarify a few points about the evidence before merging?

  • The Claude Code test plan says a Skill was selected in every case. In all three iterations, the relevant and competing cases invoked their expected Skills, and the unrelated case showed no Skill invocation. The competing case produced the expected marker in only one of the three iterations.
  • For Codex, could we say it passed all nine behavioral checks? The report says Codex has no engine-level selection signal, so “routing is 9/9” is stronger than the evidence supports. The observed SKILL.md reads can be reported separately.
  • The catalog column can report yes based on ordinary assistant text. A transcript containing only “There are no available skills.” is enough to trigger it. Could we restrict the check to the system or developer event that carries the catalog, or label the column catalog reference if it remains a text heuristic?

The first step of alibaba#166 is to find out what native evidence an engine emits
when it selects, loads or applies a Skill, instead of inventing a
skill_activated assertion before the evidence exists.

Add a small, repeatable canary: two Skills with disjoint triggers write
marker files that the case expectations check, so green means the Skill body
was applied rather than echoed. A runner script executes the canary per
engine with --no-delete and a summary script reports the Skill-related
events found in each transcript.

The investigation report records what the canary observed on claude_code
2.1.317 and codex 0.166.0 (both 3/3 PASS): Claude Code emits a structured
Skill tool call with a paired result, while Codex only injects a skill
catalog and reads SKILL.md as an ordinary command. It also documents the
engine-global skill roots that leak into the selection surface, the install
name vs declared name mismatch, and why neither engine's evidence yet
supports 'applied'. No schema, capability flag or assertion is added.
summarize.py now keeps cases whose transcript is missing, reports the
execution status from result.json next to an explicit transcript state, and
labels a SKILL.md payload as a reference rather than a read. run.sh replaces
out/<engine> instead of overlaying it and exits nonzero when an engine fails,
so a missing measurement cannot look like a clean result. Adds fixture tests.
… the fixture name

Three iterations per engine separate two measurements the single-pass run had
merged: Claude Code routed all nine cases correctly (a Skill call in every
transcript that needed one), but applied the marker instruction only 1/3 in the
competing case after loading the right Skill - the model translated the line
itself and said the instruction looked artificial. Codex applied 3/3.

The earlier fixture named the second Skill canary-decoy. One run read that name
from the catalog and answered that it was a decoy rather than a real Skill, so
it never applied. The fixture now uses literary-translation, a neutral name, and
summarize.py follows the new marker.
@Walternater

Copy link
Copy Markdown
Contributor Author

All three synced, plus one code change behind them (a24c776).

Claude Code wording. The test plan now separates selection from application: the relevant and competing cases invoke their expected Skill in all three iterations and unrelated invokes none (9/9 selection evidence), while the competing marker is written 1/3. The results table caption in docs/design/routing-canary.md says the cells are grading outcomes, not selection events.

Codex. Dropped the "routing 9/9" claim for Codex. It has no selection event, so the description now says selection is not measured there: all nine runs passed grading and each references the expected SKILL.md, which the summary reports per run.

catalog. Fixed at the source instead of relabelling: summarize.py now only counts the catalog in a system/developer message (Codex injects it as a developer message), so assistant text such as "There are no available skills." no longer sets the column. Two tests cover it — one where assistant prose alone must report no, one where a developer message must report yes; the second assertion checks the last cell specifically, since the row has several yes/no cells. With the old text-only check the assistant-prose test fails ('yes' != 'no'). The column doc in docs/design/routing-canary.md explains the restriction.

python3 -m unittest discover -s scripts/routing-canary → 8 tests OK, bash -n and npm run docs:build pass.

@zpzjzj

zpzjzj commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for tightening the catalog evidence in a24c776. One evidence-handling case remains before merge: the summarizer can label an empty or entirely unparseable transcript present and report no for catalog and skill-file evidence. The OpenCode adapter can leave an empty stdout artifact even when execution fails. Please distinguish missing, empty/unparseable, and parsed transcripts, and show evidence as unknown when there are no usable records. An offline fixture for an empty transcript and one for invalid JSONL would cover this without a live model run.

The summarizer labelled an empty or entirely unparseable transcript as
present and reported the Skill evidence as absent, but such an artifact
proves nothing: the OpenCode adapter can leave an empty stdout file even
when the run failed.

Distinguish the transcript states now, and keep the Skill evidence unknown
until a usable record exists. Two offline fixtures cover the empty and the
invalid JSONL case.

Co-Authored-By: Claude Code <[email protected]>
@Walternater

Copy link
Copy Markdown
Contributor Author

Fixed in 3e9abc3.

The summarizer now distinguishes the transcript states instead of collapsing them into present:

  • missing — no transcript artifact.
  • empty — the artifact exists but holds no record.
  • unparseable — the artifact holds lines that are not JSON.
  • present — at least one usable record.

The Skill evidence columns (skill tool call, skill file reference, markers, catalog) stay unknown (-) whenever the transcript has no usable record, so an empty artifact is never read as an observed absence of the Skill.

Two offline fixtures cover it: test_empty_transcript_reports_unknown_evidence and test_unparseable_transcript_reports_unknown_evidence. python3 -m unittest scripts/routing-canary/test_summarize.py passes (10 tests).

@zpzjzj

zpzjzj commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Thanks, @Walternater, for the update and for fixing the engine-name validation and distinguishing empty or wholly invalid transcripts from missing ones. I’d hold off on merging for one remaining evidence-handling case: the summarizer still treats any successfully decoded JSON value as a usable event and ignores malformed lines if anything else parses. That means a transcript containing only null, or a valid event followed by a truncated line, can still report no for catalog or Skill-file evidence when the right answer is unknown.

Could you preserve positive evidence from readable events, mark unobserved evidence as unknown when the transcript is incomplete or has no usable events, and add an offline fixture for each case? Please also update the design report’s transcript-state table to match.

A decoded value that is not a JSON object or an array is not a record, so a
transcript of `null` lines holds no record. A line that did not decode can
hold the evidence that was in it, so a transcript that has records and a
truncated tail keeps the evidence its readable events show and reports the
signals those events do not show as unknown instead of absent.

Two offline fixtures cover the `null` transcript and the truncated tail, and
the design report's transcript-state table lists the states.

Co-Authored-By: Claude Code <[email protected]>
@Walternater

Copy link
Copy Markdown
Contributor Author

Fixed in 8295a41.

A record is a JSON object or an array. A line that decodes to null — or to a scalar — is not a record, so a transcript of null lines now holds no record and is reported as transcript empty; its evidence columns stay - instead of claiming the Skill was absent.

A line that did not decode makes the transcript incomplete. The evidence the readable events show is kept (the observed Skill tool call and the observed SKILL.md reference stay), and the signals those events do not show are reported as unknown (-) instead of no, because the truncated part can hold them.

Two offline fixtures cover exactly those cases: a transcript of null lines, and a valid event followed by a truncated line. The design report's transcript-state table now lists present, incomplete, empty, unparseable and missing, with a paragraph on what a record is and why an incomplete transcript reports unknown instead of absent; examples/routing-canary/README.md says the same.

Verified: python3 -m unittest discover -s scripts/routing-canary → 12 tests OK, and the two new fixtures fail against the previous summarizer (present instead of empty, present instead of incomplete).

@CLAassistant

CLAassistant commented Nov 24, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@zpzjzj

zpzjzj commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks, @Walternater, for adding the null-only and truncated transcript fixtures. I missed one related case: the existing OpenCode adapter test, TestOpenCodeErrorEventFailsEvenWithAssistantText, already uses a fixture with a text event followed by a structured error event (provider unavailable). The adapter treats that run as failed, but both lines are valid JSON, so the canary summarizer would mark the transcript as present and report no for the catalog and Skill-file reference. The fixture shows that the run failed, not that those signals were absent.

Could you reuse that fixture in an offline summarizer test? Please keep the execution status as ERROR, show unobserved Skill evidence as - (unknown), and preserve any positive evidence recorded before the error. There’s no need to rerun the live engines.

A transcript can be readable and still say the run failed: the OpenCode
adapter fails on its `error` event, and the Claude Code stream ends with a
`result` event flagged `is_error`. The summary called such a transcript
`present` and reported the Skill evidence it never reached as absent, which
reads as "the Skill was not used" for a run that never got that far.

The summary now reports those transcripts as `failed`: the signals the run did
not reach stay unknown (`-`), like the ones a truncated transcript cannot
settle, and the evidence it did produce before it failed is kept. The two
error shapes are the ones the adapters already read.

Tests: the fixture of `TestOpenCodeErrorEventFailsEvenWithAssistantText` in
internal/agent/opencode_test.go, as an offline summarizer test, plus one for
the evidence observed before the error.
@Walternater

Copy link
Copy Markdown
Contributor Author

Fixed in ab67b68.

A transcript that reports the run failed is failed, not present. The two shapes are the ones the adapters already read: OpenCode's type: "error" event (the toolStatusError case in internal/agent/opencode.go) and the Claude Code stream's result event flagged is_error (internal/agent/claude_code.go). Codex's stdout has no run-level error event — a failed MCP tool call carries error inside the item, not at the top level — so it is not misread as a failed run.

A failed run says unknown, not absent. The signals the run never reached are reported as -, the same as the ones a truncated transcript cannot settle: the run failed, so it never got far enough to produce them. The evidence it did produce before it failed is kept.

Two offline fixtures cover it:

  • the fixture of TestOpenCodeErrorEventFailsEvenWithAssistantText (internal/agent/opencode_test.go:238) — a text event followed by the structured error event, both valid JSON — used as an offline summarizer test: the execution status stays ERROR (it comes from result.json), the transcript is failed, and the Skill tool call, the SKILL.md reference and the catalog are all -;
  • a second fixture with a Skill call and its SKILL.md reference before the error: both are preserved, and the catalog — never reached — stays -.

The design report's transcript-state table now lists failed among the states, with a paragraph on why a failed run reports unknown instead of absent; examples/routing-canary/README.md says the same.

Verified: python3 -m unittest discover -s scripts/routing-canary -p "test_*.py" → 14 tests OK, and both new tests fail against the previous summarizer (present instead of failed). No live engines rerun.

Disclosure: written with AI assistance (Claude Code for the original change, Codex for this follow-up), operated by wangchongfei, who is responsible for every line here.

@zpzjzj

zpzjzj commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Thanks, @Walternater, for fixing the structured OpenCode error case. I rechecked 014239c: the two regression fixtures still cover that fix, and the CLA and CI gate are now green.

One gap remains: an agent can time out after writing a valid text event without emitting a structured error event. result.json can already report ERROR, but the summarizer uses that status only for display, so unobserved catalog or Skill-file evidence can still show up as no. Could you use execution ERROR as a fallback to report unobserved signals as - (unknown), while preserving any positive observations? One offline fixture with ERROR and a valid text event but no error event would cover it. No live rerun needed.

…iled

A run can time out after writing a valid text event without emitting a
structured error event. The transcript then looks complete, so nothing in it
says the run stopped early, and an unobserved catalog or SKILL.md reference was
reported as `no` — absent — while `result.json` already reported `ERROR`.

`summarize_case` now uses that execution status as the fallback signal: when it
is `ERROR`, the signals the transcript never showed are unknown (`-`), which is
exactly what the structured error path already does. Positive observations are
kept — the run did reach those before it failed.

Two offline fixtures: one for the downgrade (valid text event, no error event),
one for the preserved positives. Both fail on 014239c.
@Walternater

Copy link
Copy Markdown
Contributor Author

Done in d7236f8.

The fallback. summarize_case now uses the execution status as the signal it was missing: when result.json reports ERROR, the evidence the transcript never showed is reported as - (unknown) rather than no. That is the same rule the structured-error path already applies (unknown = None if (unparseable or failed) else False), it just no longer depends on the transcript carrying an error event.

Positives are untouched. Only "not observed" is downgraded. A Skill call or SKILL.md reference the run did reach before it stopped stays as it was — that is the second fixture.

One deliberate choice worth flagging: the transcript column stays present in this case. The transcript really is readable and complete — it is the run that failed, and the execution column already says ERROR. Saying failed there would claim the transcript reported a failure it never reported.

Fixtures (offline, no live rerun):

  • test_timeout_without_an_error_event_reports_unknown_evidence — ERROR, a valid text event, no error event → skill_file_referenced and catalog_injected are -, not no.
  • test_timeout_keeps_the_evidence_it_did_observe — same status, but the run did call Skill first → the call and the reference stay positive.

Both fail on 014239c with - no / + -, so they cover this and not something adjacent.

@zpzjzj zpzjzj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zpzjzj
zpzjzj added this pull request to the merge queue Nov 25, 2026
Merged via the queue into alibaba:main with commit 5127b0d Nov 25, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add routing-focused eval support

3 participants