Skip to content

Add submit_result typed reporting channel for Tier 3 leaves - #602

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-6946-submit_result-with-a-required-output-json-schema-replacing
Aug 24, 2026
Merged

Add submit_result typed reporting channel for Tier 3 leaves#602
TheGreatAxios merged 2 commits into
mainfrom
cl-6946-submit_result-with-a-required-output-json-schema-replacing

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • CL-6946 part 1/2: additive typed reporting channel alongside the existing markdown envelope.
  • submit_result mounts only on Tier 3 leaves (params.tier === "leaf", gated via the existing authority.ts/tier machinery — no parallel mechanism).
  • DirectorPackage.reportContract.outputSchema (new optional field, src/agent/directors/types.ts) lets a director declare a JSON Schema for the payload, validated with ajv.
  • Invalid submissions return a correction (non-terminal), capped at 3 rounds (SUBMIT_RESULT_MAX_CORRECTIONS, src/subagent/submit-result.ts), using ajv's own error output for the correction message.
  • A per-turn token is generated at dispatch, stated in the dispatch brief, and required on submit_result; a stale/mismatched token is rejected.
  • Did not touch stop-policy.ts's listed functions or anything under vendor/.

Note for part 2

The ticket assumed a pre-existing ReportContract type. No such type existed — the real
existing seam was buildSubAgentReportContract() in src/agent/prompts.ts plus the
director-package concept. This PR adds ReportContract fresh on DirectorPackage
without renaming or removing anything. Part 2 should look there, not for a predating type.

Test plan

  • bun run check (lint, typecheck, build, full test suite) — green.
  • New: src/subagent/submit-result.test.ts — valid submission succeeds; invalid submission returns a correction then resubmit succeeds; stale turn token rejected; correction cap enforced.

@linear-code

linear-code Bot commented Aug 24, 2026

Copy link
Copy Markdown

CL-6946

Mounts on leaf-tier workers only (existing authority.ts/tier gate).
DirectorPackage.reportContract.outputSchema is an optional JSON Schema;
an invalid submit_result payload returns a correction (non-terminal,
capped at 3 rounds) instead of failing the run. Requires a per-turn
token generated at dispatch and echoed back, rejecting stale/superseded
turns. Purely additive — the markdown report envelope path is untouched.
Replaces the draft-07 partial validator with ajv (already resolved
transitively via @modelcontextprotocol/sdk) and surfaces its error
output directly in the correction message sent back to the worker.
@TheGreatAxios
TheGreatAxios force-pushed the cl-6946-submit_result-with-a-required-output-json-schema-replacing branch from 87ccc00 to 4244d37 Compare August 24, 2026 05:43
@TheGreatAxios
TheGreatAxios enabled auto-merge (squash) August 24, 2026 05:43
@TheGreatAxios
TheGreatAxios merged commit 2d86844 into main Aug 24, 2026
5 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.

1 participant