Skip to content

feat(external-agents): report harness facts, breaker state and plan usage - #18330

Merged
kyle-sexton merged 5 commits into
mainfrom
feat/external-agents-harness-facts-usage
Nov 23, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
feat/external-agents-harness-facts-usage

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

No related issue: Phase 5 of the owner-approved vendor-routing plan (PR-A of four).

Summary

external-agents now reports what each harness can do and how much plan usage is left, so
/multi-agent:route vendors can skip a vendor that lacks a tool or is out of usage.

  • models <product> adds product tools and image, per-model context_window when the CLI
    reports it, and breaker (open, reason, reset_at). The document schema stays 1, because
    every field is additive.
  • New usage <product>: one call outside delegated runs, printing a UsageReading
    (status, remaining as a 0 to 1 fraction, window, resets_at, source). It prints no
    account ids, emails or plan names.
    • Codex: codex app-server over stdio, account/rateLimits/read. stdin stays open until the
      reply arrives, and notifications are ignored.
    • Antigravity: agy --output-format json -p=/usage, with slash commands on. It reports the
      lowest remaining window and lists every window.
  • AC16: agy's print-mode subagent tools already run with --disable-slash-commands, so the
    provider gets no new flag. /swarm and /teamwork stay unoffered.

Fix

  • scripts/lib/usage.mjs (new): two readers, chosen by the provider record's usage.kind.
  • providers/*.yaml: new harness and usage sections (data, validated in provider.mjs).
  • scripts/lib/models.mjs, scripts/lib/breaker.mjs: the new models fields.

Verification

  • node --test --test-concurrency=4 over the plugin's four test files: 160 tests, 159 pass,
    0 fail, 1 skipped (a POSIX-only execute-bit case).
  • Live on Windows, external-agents usage codex and usage antigravity each returned
    status: ok with a remaining fraction, window and reset. models codex reported a
    context_window per model.
  • Probe record for the two usage readouts and AC16: the plan's Phase 1 probes
    (codex app-server generate-json-schema names account/rateLimits/read; an agy
    invoke_subagent call ran as its own conversation under --disable-slash-commands).

Related

  • Built by Antigravity from the Phase 5 brief, then reviewed, tested and committed by Claude.
  • Next: PR-C2 (Phases 7-8) reads these fields for harness gating and the usage tiebreak.

🤖 Generated with Claude Code

https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3

kyle-sexton and others added 2 commits November 22, 2026 22:56
…sage

`models <product>` adds product `tools` and `image`, per-model
`context_window` when the CLI reports it, and `breaker` state; the
document schema stays 1. New `usage <product>` reads plan usage outside
delegated runs (Codex app-server account/rateLimits/read; agy -p=/usage)
and reports remaining as a 0 to 1 fraction, with no account details.

The antigravity skill now lets a session set the write ceiling in the
personal layer when the user asks for agy to write in their own words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 23, 2026 04:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 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-23T04:16:37.494737Z 6c8b921 Draft marked ready
ℹ️ 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: 6c8b921139

ℹ️ 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".

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs

Run 45110607116, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 45110607116

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-security-review: 1 inline finding(s) on 6c8b921139df5a6a5089b8ee46424a80a783f666; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 789e36fd19c99d6d0b5e8f484cb7f0c824bffffd: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #18330, incremental (0cf9d27..789e36f)

No security issues found in this push. I read every hunk of all three files in scope in .claude-lane/incremental.diff. This lane already reviewed earlier heads, so this review reports only blocking findings (CRITICAL and IMPORTANT).

What changed

  • plugins/external-agents/scripts/lib/usage.mjs: each Codex usage window now has a group field. Its value is the literal string primary or secondary, taken from the parser's own fixed list. Before the reading is built, the code removes group from the window it reports (the one with the least left). The group field stays on each entry in windows.
  • plugins/external-agents/tests/update.test.mjs: the test now checks the group value of each window, and checks that the top-level reading has no group field.
  • plugins/external-agents/README.md: describes how the Codex reader now works. Documentation only.

What I checked

  • Where group comes from: the code sets it from the hard-coded ["primary", "secondary"] list, not from the app-server reply. A hostile or malformed reply therefore cannot put its own text into the printed output through this field. The other window fields are built as before: remaining (clamped to 0..1), window (from formatMinutes) and resets_at (an ISO date from a positive finite number). No other field from the reply can reach the output.
  • Inputs: the push adds no new input from argv, stdin, the environment or the filesystem. The spawn path and the JSON-RPC payload are unchanged.
  • Failure handling: if neither window has a finite usedPercent, the reader still returns ok: false.

Earlier findings: the one earlier inline finding (the write ceiling in skills/antigravity/SKILL.md) was a SUGGESTION on a file this push does not touch. I did not post it again, because this review reports blocking findings only.

Not in this push: no plugin manifest, workflow, trusted-actor list, token request, kill switch, merge hold or instruction file changed.

Spend: none beyond before. usage codex still makes one app-server call each time it runs, which uses subscription quota only.

The PR context contains no text that tries to instruct the lane.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 789e36fd19c99d6d0b5e8f484cb7f0c824bffffd: read 3 of 3 changed file(s); 1 finding(s), 0 as inline comments.

Incremental code review: Codex windows entries now carry group

Scope: the changes since 0cf9d27, in plugins/external-agents/README.md, plugins/external-agents/scripts/lib/usage.mjs and plugins/external-agents/tests/update.test.mjs. I read all three hunks in full. This lane already reviewed an earlier head, so this review reports blocking findings only.

The push fixes my earlier inline finding (thread resolved at this head, lines unchanged since then):

  • Code: each Codex windows entry now has group (primary / secondary), and the destructure at usage.mjs:44 keeps group out of the top-level reading.
  • README: the Codex bullet at README.md:88-91 now describes the two-window reader. It matches the windows row at L84 and the windows.length > 1 condition at usage.mjs:50.
  • Test: it checks the group order and that reading.group is undefined.

I found no new blocking problem in this push.

Findings

  1. Restated from the earlier summary (no line anchor; this push didn't fix it): the app-server's stderr is piped but never read. usage.mjs:58 still passes stdio: ["pipe", "pipe", "pipe"] to start, and nothing reads child.stderr. Neither usage.mjs nor process.mjs start (L22-25) drains it.
    • If codex app-server fills the stderr pipe buffer before it sends the id: 1 reply (for example with verbose logging on, or while an auth refresh fails), it blocks. The command then reports timed out after 15000 ms instead of a reading.
    • Unread stderr can also hold back the close event after an early exit, so app-server exited <code> becomes the same timeout.
    • Fix: use "ignore" for the third stdio entry, or call child.stderr.resume().

Other checks

  • Closing issue: none. The PR is one phase of a plan, so there are no acceptance criteria to check.
  • Unverified claims: the author's test runs are claims I have not checked. I ran nothing.
  • Plugin manifests: no manifest changed in this push.
  • Settled threads: the secondary-window, windows group/README and antigravity SKILL.md threads are all resolved. None is raised again.
  • Loosened checks: none. The test swaps a length check for a stricter group check and adds an assertion.
  • Loosened-check settings: the prompt had no loosened_check_verdict: or loosened_check_patterns: line, so I used fail with no consumer entries. It had no loosened_check_decision_record: line either, so I didn't check the citation requirement.
  • Loosened checks would be marked: fail (plugin default); patterns: 0.

I ran no verifier subagent. I checked the one candidate against the head file myself.

Verifier dropped 0 of 1 candidates.

kyle-sexton and others added 2 commits November 23, 2026 00:27
…ipped

The reworded gotcha let any session set the write ceiling when its user
asked, which changes ADR 0119's opt-in rule for every installer. That is
the owner's decision to make, so the shipped text goes back to main's
version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
When Codex's secondary window was exhausted and its primary still had
room, `usage codex` reported the primary's remaining fraction. It now
reads both windows, reports the one with less left, and lists both in
`windows`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on 0cf9d27f2164bd58d84f39932277dd50f913a5ca; the summary is in this lane's pull request comment.

claude-lane: claude-review

…eader

Each Codex entry in `windows` now carries `group` (`primary` or
`secondary`), matching the shape the README promises and the agy entries.
The README describes the two-window Codex reader.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfo1FXD2G3F4XBaDn3
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit b8a9f4a Nov 23, 2026
69 of 70 checks passed
@kyle-sexton
kyle-sexton deleted the feat/external-agents-harness-facts-usage branch November 23, 2026 06:33
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant