Skip to content

feat(runner): conform storyboard output to adcp runner-output contract (#599) - #611

Merged
bokelley merged 4 commits into
mainfrom
bokelley/issue-599
Apr 19, 2026
Merged

bokelley merged 4 commits into
mainfrom
bokelley/issue-599

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

Closes #599. Conforms the storyboard runner and comply() output to the universal runner-output contract in adcontextprotocol/adcp#2364 / issue #2352.

Today a failed validation reads:

FAILED: schema_validation/capability_discovery
  - Check agent capabilities

with no actionable detail. After this PR, the same failure carries RFC 6901 json_pointer, the exact schema_id + fetchable schema_url, AJV-shaped error array, and the request/response bytes — so the buyer diagnoses their agent from the report instead of re-running the step by hand.

What changes

Per-validation (on every failure):

  • json_pointer — RFC 6901 pointer to the failing field
  • expected / actual — machine-readable values
  • schema_id / schema_url — on response_schema checks
  • request / response — exact bytes the runner sent + observed
  • response_schema failures now emit AJV-shaped { instance_path, schema_path, keyword, message }[] instead of a flat message string

Per-step:

  • extraction: { path: "structured_content" | "text_fallback" | "error" | "none" }
  • request / response_record
  • storyboard_id — each step is self-describing
  • skip: { reason, detail } — structured skip result

Spec skip reasons. The narrow "not_testable" | "dependency_failed" | "missing_test_harness" | "missing_tool" enum is replaced by the six contract reasons, each with a human-readable detail explaining why (naming the missing tool, the prerequisite step id, the agent's advertised tool list, etc.).

Top-level summary: gains total_steps, steps_passed, steps_failed, steps_skipped, and schemas_used: Array<{ schema_id, schema_url }>.

Formatter: terminal output now renders At: / Expected: / Actual: / Schema: for each failure. Agent-controlled error and actual strings run through the existing fenceAgentText() nonce.

Security hardening

  • Redaction. Request and response payloads are recursively scrubbed; values at keys matching /^(authorization|credentials?|token|api[_-]?key|password|secret|client[_-]secret|refresh[_-]token|access[_-]token|bearer|session[_-]token|offering[_-]token|cookie|set[_-]cookie)$/i become "[redacted]" before they're persisted. The contract spec calls for exactly this.
  • Header allowlist. Response headers pass through a short allowlist (content-type, content-length, content-encoding, www-authenticate, location, retry-after, x-request-id, x-correlation-id); everything else (including set-cookie, authorization, x-internal-*, x-amz-*) is dropped. Without this a hostile agent could bait the runner into publishing internal breadcrumbs in a shared report.
  • Request headers are deliberately NOT captured to avoid echoing Authorization: Bearer <token> from auth-override probes.
  • LLM fencing. Formatter output runs agent-controlled error + actual through fenceAgentText() so downstream summarizers can't be hijacked by hostile error messages.

Tests

  • test/lib/storyboard-runner-contract.test.js — 14 new tests covering: json_pointer on field_present/field_value, allowed_values expected/actual, schema_id/schema_url on response_schema, AJV shape, no-schema-registered structured actual, http_status expected/actual, request/response echo on failure (and omission on pass), JSON Pointer RFC 6901 escaping, redaction, header allowlist, skip-reason warnings.
  • test/lib/storyboard-skip-counting.test.js — migrated missing_test_harness → missing_test_controller.

Breaking change

The StoryboardStepResult.skip_reason enum is renamed. Third-party automation reading the --json output needs to migrate from "not_testable" / "dependency_failed" / "missing_test_harness" to the six spec-aligned values. The bundled CLI (bin/adcp.js) is updated in-tree. Minor bump per the changeset.

Review

  • Reviewed by code-reviewer and security-reviewer subagents; all Must Fix and load-bearing Should Fix findings addressed in the committed diff (CLI skip-icon migration, AJV schema_path correctness, structured actual on no-schema, no_phases wired into the runner, response-header allowlist, request/response redaction, LLM fencing).

Test plan

  • npm run typecheck
  • npm run build
  • node --test test/lib/storyboard-runner-contract.test.js test/lib/storyboard-skip-counting.test.js test/lib/storyboard-validations.test.js test/lib/storyboard-observations.test.js test/lib/compliance.test.js test/lib/storyboard-brand-invariant.test.js — all green
  • node --test test/lib/storyboard-security.test.js — all green (one pre-existing network-dependent test times out; identical behavior on main)
  • CI green

🤖 Generated with Claude Code

…contract (#599)

Implements the actionable-failure contract from adcontextprotocol/adcp#2364:
every failed validation now carries RFC 6901 `json_pointer`, structured
`expected`/`actual`, `schema_id`/`schema_url` on response_schema checks,
and the exact request/response bytes — so buyers can self-diagnose agent
failures without re-running the step by hand. Skip reasons migrate to the
six spec-aligned values (`not_applicable`, `no_phases`,
`prerequisite_failed`, `missing_tool`, `missing_test_controller`,
`unsatisfied_contract`) with human-readable `detail`. Request/response
payloads are redacted by key name; response headers run through a short
allowlist to stop agent-controlled `set-cookie` / `x-internal-*` from
landing in shared compliance reports. Agent-controlled `error` and
`actual` strings are fenced in the terminal formatter so downstream LLM
summarizers can't be hijacked.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley force-pushed the bokelley/issue-599 branch from bb8aa0a to 1584cd8 Compare April 19, 2026 11:04
…gning grader (#600)

main's new request-signing grader (#585) introduced grader-specific skip
reasons (probe_skipped, rate_abuse_opt_out, missing_test_kit_contract,
live_side_effect_opt_in_required, operator_skip, not_in_only_vectors,
grader_skipped). Keep the six canonical RunnerSkipReason values as the
contract-conformant set on skip.reason, and widen skip_reason to also
accept RunnerDetailedSkipReason. A DETAILED_SKIP_TO_CANONICAL map
projects grader reasons onto their spec equivalents so runner-output
consumers see a stable enum regardless of which subsystem emitted the
skip. The probe self-skip branch now populates the full set of
contract-required fields (request, response_record, extraction, skip)
alongside the detailed skip_reason.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley

Copy link
Copy Markdown
Contributor Author

Closes the loop on adcontextprotocol/adcp#2352 / adcontextprotocol/adcp#2364. Couple of notes from the spec side.

Implementation lands the contract cleanly. Walked the diff of src/lib/testing/storyboard/types.ts — the ValidationResult, RunnerRequestRecord, RunnerResponseRecord, RunnerExtractionRecord, RunnerSkipResult, and SchemaValidationError shapes match the contract YAML. DETAILED_SKIP_TO_CANONICAL is the right pattern for runners that need narrower internal reasons — the spec only mandates the six canonical values, runners can emit their own taxonomy and map to those. Worth adding a paragraph in the contract YAML acknowledging the pattern.

Backporting to the spec. Several of the security decisions here aren't in adcontextprotocol/adcp#2364 yet and should be, otherwise a third-party runner could legitimately claim contract conformance while leaking credentials:

  1. Key-name-pattern redaction of request.payload / response.payload — the regex /^(authorization|credentials?|token|api[_-]?key|password|secret|client[_-]secret|refresh[_-]token|access[_-]token|bearer|session[_-]token|offering[_-]token|cookie|set[_-]cookie)$/i is a concrete pattern worth promoting to a MUST in the contract. Individual runners won't derive this from scratch.
  2. Response-header allowlist — your allowlist (content-type, content-length, content-encoding, www-authenticate, location, retry-after, x-request-id, x-correlation-id) is tight enough to be a reasonable floor. Spec should name it explicitly and say everything else MUST be dropped.
  3. Request headers MUST NOT be captured — or if they are, auth-related ones redacted. The contract currently leaves this as an optional field with no redaction requirement; that's unsafe.
  4. LLM-fencing of agent-controlled strings in rendered output — error and actual pass through a hostile agent. Formatter contract should state agent-controlled fields are fenced before being handed to downstream summarizers.

I'll push updates to #2364 referencing #611 as the conforming implementation and backport items 1–4. Happy to cut a follow-up PR on this repo if anything falls out of spec once that lands.

One small thing re `text_fallback`. The code note says it's reserved until extraction provenance is plumbed through TaskResult. Worth a follow-up issue against adcp-client so it doesn't get forgotten — the distinction between structured_content and text_fallback is the load-bearing part of the extraction block for diagnosing MCP extraction bugs. Happy to file it.

LGTM on the substance.

bokelley and others added 2 commits April 19, 2026 07:36
 #619)

Every StoryboardStepResult.extraction.path now reflects the actual
unwrap branch instead of an inference. The response unwrapper tags the
unwrapped AdCPResponse with a non-enumerable _extraction_path property;
executeStoryboardTask reads it via readExtractionPath() and surfaces it
on TaskResult; runner.extractionFromTaskResult prefers the stamped
value. rawMcpProbe (which bypasses the unwrapper) sets the tag
directly. All four contract values — structured_content, text_fallback,
error, none — are now emitted in practice; text_fallback was previously
unreachable because provenance was lost during unwrap. Non-enumerable
so JSON.stringify, spread, and Object.keys all ignore it — only the
runner reads it.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…reasons (#617)

The request-signing grader's MCP-transport mode (#617) adds a new
grader-specific skip reason. Adopt it into RunnerDetailedSkipReason and
route it through DETAILED_SKIP_TO_CANONICAL as `not_applicable` — the
vector is skipped because the transport doesn't exercise URL-edge
semantics, which is a scope gap (agent didn't opt into the vector) not
a contract failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.

Conform runner output to adcp runner-output-contract (failure detail, skip reasons, extraction path)

1 participant