Skip to content

fix: preserve Codex usage when a turn fails - #440

Closed
mnajafian-nv wants to merge 120 commits into
NVIDIA:mainfrom
mnajafian-nv:fix/codex-usage-on-failure
Closed

mnajafian-nv wants to merge 120 commits into
NVIDIA:mainfrom
mnajafian-nv:fix/codex-usage-on-failure

Conversation

@mnajafian-nv

@mnajafian-nv mnajafian-nv commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Overview

A Codex turn can fail after model calls have returned usage. A thread-wide token snapshot also cannot show whether individual responses omitted usage fields.

Read original completion notifications for each turn. Keep accounted usage after a failed completed turn. RunResult.model_usage retains observations and gaps when execution is interrupted or coverage cannot be established.

Dependency: Merge after #458, which includes #442 shared accounting. The adapter keeps #458's version reports alongside usage evidence. The diff against main includes these unmerged prerequisites.

Details

Enable raw events through the pinned SDK request API and collect response IDs within the turn. Preserve missing fields before SDK normalization and deduplicate response reports. Keep the cumulative thread snapshot separately in output.usage; it does not replace missing response evidence.

Retries, ambiguous errors, missing reports and conflicting duplicate IDs leave accounting gaps. Without turn/completed, the runtime becomes unusable so late usage cannot enter another invocation. A failed status on a completed turn does not, by itself, invalidate accounted model calls.

Collection covers the parent turn started by the invocation. Actual subagent dispatch leaves descendant coverage unverified. Independently started turns joined by the SDK and hidden model calls inside external tools are outside the collection boundary.

The notifications do not establish per-model token allocation or provider-reported cost. The configured model name therefore does not authorize pricing these observations. Shared accounting in #442 handles normalization and completeness.

Validation

Focused Codex adapter, accounting and provenance tests passed. Run the adapter regressions from a synchronized development checkout:

python -m pytest -p no:cacheprovider tests/adapters/test_codex_adapter.py tests/adapters/test_codex_usage_accounting.py -q

Regression tests cover failed completed turns, missing completion notifications, transport failures, omitted fields, duplicate response IDs and actual child dispatch. The interrupted-turn cases check that the runtime cannot be reused and late usage cannot enter another invocation.

Where should the reviewer start?

Start with _turn_notifications, _run_turn and the unusable-runtime guard in adapters/python/codex/src/nemo_fabric_adapters/codex/adapter.py. Review tests/adapters/test_codex_usage_accounting.py for failed completion, interruption, omitted fields and duplicate IDs.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • Relates to: none

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.

  • I searched existing issues and open pull requests, and this does not duplicate existing work.

The Codex adapter ran each turn with the SDK's AsyncTurnHandle.run(), which raises on a failed turn and is cancelled on a timeout. The token usage snapshots Codex had already sent for that turn were dropped with it, so a failed, timed-out or disconnected invocation reported no usage even though its model calls had spent tokens.

The adapter now reads the turn's notification stream itself, records the last thread token usage snapshot, and hands the same stream to the SDK's turn collector. When the turn fails, times out or loses its connection, that snapshot goes into the failure output and is differenced against the runtime baseline like a successful turn. Usage covers the snapshots Codex sent before the failure. Codex sends a response's usage after its tool calls finish, so on a timeout the last response is not counted if it was still streaming or its tools were still running.

Codex marks a context-window overflow by replacing the thread total with the window size, all other counters zero, and then fails the turn. The adapter skips that snapshot so it never reports the window size as spent tokens.

A request rejected before its turn starts, such as non-text input, used to clear the usage baseline. The next successful invocation then reported no usage. Codex's thread totals do not move when no turn runs, so the adapter now keeps the baseline in that case.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
The Deep Agents adapter summed usage_metadata from the AI messages that
reached graph state through the updates stream. Three cases came out
wrong:

- Deep Agents adds SummarizationMiddleware to every agent and subagent.
  Its summary call returns only text, so the summary model's message
  and usage never enter graph state, and an invocation that summarized
  under-reported input, output and total tokens.
- When the invocation raised, including GraphRecursionError, the
  adapter returned no messages, so usage was None even though model
  calls had finished.
- A count was summed over the calls that reported it and returned as
  known. ChatOpenAI also turns an omitted Chat Completions count into 0
  and derives a missing total, so a partial provider report came out as
  measured zeros.

The adapter now records usage from LangChain's chat-model callbacks,
which fire for every chat-model call that runs in the adapter process:
the main agent, declarative subagents and summarization. Agent Protocol
subagents run remotely and are not included. A new recorder is created
for each invocation, so earlier turns are never counted again. It
outlives an exception, so a failed invocation still reports the fields
that every counted call reported.

Each token count and the cost are known only when every counted call
in the invocation reported them, and an explicit zero stays a known
zero. A request the provider rejects with a 4xx status (other than 408)
contributes no usage. A 5xx response, timeout, cancellation or
unfinished call leaves the invocation's counts and cost unknown,
because the provider may have done work without reporting usage.
OpenAI SDK retries happen inside one LangChain call, so a 5xx the SDK
retries to success is not visible to the recorder, and only the final
response's reported usage counts. When
a response carries OpenAI-shaped raw usage, the raw counts decide what
was reported: an omitted count stays unknown, the provider's total is
used when present, and a derived total counts only when input and
output were both reported.

The graph tests run the real Deep Agents graph and ChatOpenAI against
a scripted Chat Completions endpoint for summarization, parallel task
subagents, 400, 408, 503 and timeout failures, the recursion limit,
partial reports and explicit zeros. Separate ChatOpenAI.with_retry
tests cover 429 then success and 503 then success. The existing usage tests
now produce their messages through a LangChain chat-model call so the
callbacks fire.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between a34e724 and 43bf2e3.

📒 Files selected for processing: 12
  • adapter-contract/typescript/src/usage.ts
  • adapter-contract/typescript/test/usage-reducer.test.js
  • adapters/python/common/README.md
  • adapters/python/common/src/nemo_fabric_adapters/common/relay_gateway.py
  • adapters/python/deepagents/README.md
  • docs/integrations/harness/codex.mdx
  • docs/reference/api/python-library-reference/nemo_fabric.types.md
  • docs/sdk/python.mdx
  • scripts/contracts/generate_usage_accounting.py
  • sdk/python/nemo-fabric-runtime/src/nemo_fabric/types.py
  • tests/adapters/test_adapters_common_relay_gateway.py
  • tests/python/test_model_usage.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 7 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 30
  • GitHub Check: request / require-nvskills-ci / require-nvskills-ci
  • GitHub Check: Detect docs changes
  • GitHub Check: Test (x86_64)
  • GitHub Check: Test (Python 3.13, windows-amd64)
  • GitHub Check: Qwen Code E2E
  • GitHub Check: Test (Python 3.12, macos-arm64)
  • GitHub Check: Test (Python 3.14, windows-amd64)
  • GitHub Check: Test (Python 3.12, linux-amd64)
  • GitHub Check: Test (Python 3.11, linux-arm64)
  • GitHub Check: Test (Python 3.13, macos-arm64)
  • GitHub Check: Test (Python 3.14, macos-arm64)
  • GitHub Check: Test (Python 3.12, windows-amd64)
  • GitHub Check: Test (Python 3.14, linux-amd64)
  • GitHub Check: Test (Python 3.11, windows-amd64)
  • GitHub Check: Test (Python 3.11, macos-arm64)
  • GitHub Check: Test (arm64)
  • GitHub Check: Relay 0.9 (Python 3.12, linux-amd64)
  • GitHub Check: Test (Python 3.11, linux-amd64)
  • GitHub Check: Test (Python 3.12, linux-arm64)
  • GitHub Check: Test (Python 3.13, linux-arm64)
  • GitHub Check: Test (Python 3.13, linux-amd64)
  • GitHub Check: Hermes adapter (upstream Relay 0.10, Python 3.14)
  • GitHub Check: Test (Python 3.14, linux-arm64)
  • GitHub Check: Test adapters (Node 22.19.0)
  • GitHub Check: OpenCode E2E
  • GitHub Check: Test (Node 20.18.3)
  • GitHub Check: Cline E2E
  • GitHub Check: Test (Node 24)
  • GitHub Check: Test adapters (Node 24)
  • GitHub Check: Pre-commit
🧰 Additional context used
📚 Code guidelines: 3
.agents/skills/review-doc-style/SKILL.md — configured
.agents/skills/contribute-docs/SKILL.md — configured
.agents/skills/contribute-adapter/SKILL.md — configured
📓 Path-based instructions: 11
Review Python SDK changes for typed API consistency, import-time dependency neutrality, async/session behavior, and parity with the native extension.

CodeRabbit configuration file

Files:

  • sdk/python/nemo-fabric-runtime/src/nemo_fabric/types.py
Review documentation for technical accuracy against the current API, command correctness, and consistency with generated schemas.

CodeRabbit configuration file

Files:

  • docs/integrations/harness/codex.mdx
  • docs/sdk/python.mdx
  • docs/reference/api/python-library-reference/nemo_fabric.types.md
Enforce the product name in user-facing prose: use "NVIDIA NeMo Fabric" on first use and "NeMo Fabric" thereafter.

CodeRabbit configuration file

Files:

  • adapters/python/common/README.md
  • docs/integrations/harness/codex.mdx
  • adapters/python/deepagents/README.md
  • docs/sdk/python.mdx
  • docs/reference/api/python-library-reference/nemo_fabric.types.md
Review adapter and example changes for command correctness, config/schema consistency, artifact handling, and compatibility with the public NeMo Fabric contracts.

CodeRabbit configuration file

Files:

  • adapters/python/common/src/nemo_fabric_adapters/common/relay_gateway.py
  • adapters/python/common/README.md
  • adapters/python/deepagents/README.md
Tests should cover the behavior promised by the changed API surface, including error paths, lifecycle cleanup, and SDK/native parity where relevant.

CodeRabbit configuration file

Files:

  • tests/adapters/test_adapters_common_relay_gateway.py
  • tests/python/test_model_usage.py
Source excerpt: Treat all files under `docs/reference/api/` as generated output.

CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.types.md
Source excerpt: In MDX files, top-of-file comments must use JSX comment delimiters: `{/*` to open and `*/}` to close.

CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)

Files:

  • docs/integrations/harness/codex.mdx
  • docs/sdk/python.mdx
Source excerpt: Treat these as blocking issues: MDX top-of-file SPDX comments use HTML comment delimiters instead of `{/* ...

CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

Files:

  • docs/integrations/harness/codex.mdx
  • docs/sdk/python.mdx
Source excerpt: For links between files under `docs/`, use paths relative to the source file and include the target file's `.mdx` extension.

CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

Files:

  • docs/integrations/harness/codex.mdx
  • docs/sdk/python.mdx
  • docs/reference/api/python-library-reference/nemo_fabric.types.md
Source excerpt: [ ] Relevant adapter or example `README.md` files updated when examples or adapters have changed.

CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)

Files:

  • adapters/python/common/README.md
  • adapters/python/deepagents/README.md
Source excerpt: Follow these repository-specific requirements after applying the public skill: Place a Python adapter under `adapters/python//` with `LICENSE -> ../../../LICENSE`, `README.md`, `.fabric-adapter.json`, Python pack...

CodeRabbit inference engine (.agents/skills/contribute-adapter/SKILL.md)

Files:

  • adapters/python/common/src/nemo_fabric_adapters/common/relay_gateway.py
  • adapters/python/common/README.md
  • adapters/python/deepagents/README.md
🪛 ast-grep (0.45.3)
tests/python/test_model_usage.py

[info] 496-496: use jsonify instead of json.dumps for JSON output
Context: json.dumps(rates)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

🔇 Additional comments: 12
adapters/python/common/src/nemo_fabric_adapters/common/relay_gateway.py: 1

135-139: LGTM!

tests/adapters/test_adapters_common_relay_gateway.py: 1

242-254: LGTM!

adapter-contract/typescript/src/usage.ts: 1

147-152: LGTM!

adapter-contract/typescript/test/usage-reducer.test.js: 1

50-56: LGTM!

adapters/python/common/README.md: 1

129-132: LGTM!

docs/integrations/harness/codex.mdx: 1

149-149: LGTM!

adapters/python/deepagents/README.md: 1

244-250: LGTM!

scripts/contracts/generate_usage_accounting.py: 1

25-25: LGTM!

tests/python/test_model_usage.py: 1

489-489: LGTM!

Also applies to: 495-499, 501-516, 518-537

docs/reference/api/python-library-reference/nemo_fabric.types.md: 1

2090-2096: LGTM!

Also applies to: 2512-2518

docs/sdk/python.mdx: 1

1232-1232: LGTM!

sdk/python/nemo-fabric-runtime/src/nemo_fabric/types.py: 1

2541-2545: LGTM!

Also applies to: 2584-2584, 2815-2819

Walkthrough

The change adds invocation-scoped usage accounting across adapter contracts, Codex, Deep Agents, Core normalization, runtime results, SDK summaries, schemas, tests, and documentation. Relay gateway readiness now uses a bounded 30-second startup budget.

Changes

Usage accounting

Layer / File(s) Summary
Contracts and reducers
adapter-contract/*, schemas/extensions/usage-accounting.schema.json, tests/fixtures/usage_accounting/*
Adds typed usage evidence, gaps, request and model records, Python and TypeScript reducers, shared schemas, and conformance vectors. Missing values remain distinct from reported zeroes.
Adapter collection
adapters/python/codex/..., adapters/python/deepagents/..., tests/adapters/test_codex*, tests/adapters/test_deepagents*
Codex collects deduplicated per-response usage from streamed notifications. Deep Agents records model callbacks and HTTP attempts, plus cache and remote-work scope. Both distinguish observations from complete invocation usage.
Core normalization and runtime results
crates/fabric-core/src/{usage_accounting,usage_normalization,model_usage,runtime}.rs
Core validates evidence, normalizes complete and observed usage, and adds optional RunResult.model_usage. Invalid accounting leaves the execution outcome and raw usage intact and emits a diagnostic event.
SDK summaries, schemas, and guidance
sdk/python/nemo-fabric-runtime/src/nemo_fabric/*, schemas/sdk/*, docs/*, skills/*
Adds public usage types and summarize_usage against an expected invocation inventory. Schemas, catalog entries, API references, and integration guidance describe coverage, gaps, and pricing metadata.

Relay gateway readiness

Layer / File(s) Summary
Startup readiness budget
adapters/python/common/src/nemo_fabric_adapters/common/relay_gateway.py, adapters/python/common/README.md, adapters/python/claude/README.md, adapters/python/codex/README.md, tests/adapters/test_adapters_common_relay_gateway.py
The default readiness budget changes from 10 to 30 seconds. Health probes and sleeps are capped by remaining time; early process exit and failure to become ready before the deadline fail startup.

Priority: Normal

Estimated code review effort: 5 (Critical) | ~90 minutes

Change: Feature

Possibly related PRs

Merge Risk: Minimal · previous review 43bf2

The previously reported usage-parsing mismatch is corrected at the reviewed head. No actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 18.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 323 functions across 42 files. (5 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title follows Conventional Commits format, uses the allowed lowercase type fix, summarizes the Codex usage change, and meets the length and punctuation requirements.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description is complete and follows the repository template. It includes an overview, detailed implementation context, validation steps, reviewer starting points, a related-issues sec…
Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It includes an overview, detailed implementation context, validation steps, reviewer starting points, a related-issues section, and both required confirmations. The related-issues entry states "Relates to: none," which clearly indicates that no issue is linked.

Full details: Docstring Coverage

Explanation

Docstring coverage is 18.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 323 functions across 42 files. (5 skipped: 5 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

@mnajafian-nv mnajafian-nv self-assigned this Oct 19, 2026
A RunResult says which agent and adapter ran, but not which Fabric
version, models or MCP servers were behind it, so a rerun weeks later
cannot tell what changed. Add an optional, versioned what_ran object.
Each fact holds a value, or a state and a reason, plus how Fabric
learned it: its source, collector and method.

Core fills the facts it holds before it sends the request: its own
version, the adapter ID, the requested models, the configured MCP
servers with secret-free endpoints, and the environment provider.
Core reads no adapter report yet, so adapter-reported facts read
unsupported with reason key_not_declared.

On the OpenShell host path, the host relabels the task core's facts as
task_core, records its own version as host_core_version and sets the
environment provider to openshell. A task result without a readable
what_ran keeps what_ran absent.

The Rust and Python readers apply the same structural checks, tested
against one shared vector file. A malformed what_ran reads as absent
and never fails the enclosing result. Core gains a direct dependency on
sha2 0.10, already in the lockfile, for the string length rule.

Rust code that builds RunResult with a struct literal must add the
what_ran field. Python's RunResult.to_mapping() now always includes it.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Explain the fact envelope, the four no-value states, the endpoint rule,
the OpenShell attribution and the structural read, and keep the
integration skill's RunResult table in step with the guide.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Regenerate the Rust library reference with Rust 1.94.0 for the new
what_ran module and the RunResult field, and the Python types reference
for RunResult.what_ran. Only the pages this change affects are
included.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
A plan with many model roles or MCP servers, or very long names, could
make what_ran arbitrarily large, and every RunResult carries it. Keep
it bounded without ever failing a run.

Core keeps the first 16 model roles and 32 MCP servers in sorted key
order, and drops entries whose key is longer than 128 characters. While
the compact JSON of what_ran is larger than 128 KiB, it drops MCP
servers from the end of the sorted order, then model roles. If plan
identifiers alone still exceed the budget, what_ran becomes a minimal
object with only the schema name, the version and what_ran_truncated.

A marker next to each map counts the dropped entries and names the last
rule applied. The OpenShell host applies the same bounds again after it
attributes the task core's facts, so they hold for a task core of any
version.

The six what_ran sections become optional in the Rust type so the
minimal object can be represented. Every section is still required
unless what_ran_truncated is present, and no section may be null. The
Rust reader, the generated schema and the Python reader check this
against the shared vectors.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Explain the entry caps, the key length rule, the byte budget, the
truncation markers and the minimal object, and tell readers to check
what_ran_truncated before reading a section. Keep the integration
skill's RunResult notes in step.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Regenerate the Rust library reference pages of the what_ran module for
TruncatedEntries and the optional sections, and update the Python types
reference for RunResult.what_ran. Only the pages this change affects
are included.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Run a local host invocation with two model roles and three MCP servers
(npx with arguments, streamable-http and sse) and no environment section,
and assert the exact what_ran a user gets, including the origin of every
unsupported adapter-reported fact and that no configured secret appears.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Resolve a plan from each of the 16 bundled descriptors with a model and,
where the adapter accepts MCP, three servers, and check that what_ran
passes the schema, carries no truncation marker, and reads every
adapter-reported fact as unsupported/key_not_declared. Also show that 16
roles and 32 servers with 128-character keys fit the byte budget, and
that stdio placeholders read executable_unparsed.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Loop over whatever the catalog lists without pinning its size, so adding
or removing a bundled adapter doesn't break the test. Name the size test
after what it builds: ASCII keys and model names at their maximum length.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Adapters had no way to report their own facts, so the adapter package
version, the harness name and version, the served model and the MCP
runtime facts always read unsupported with reason key_not_declared.

Core now reads nemo_fabric.versions.v1 and nemo_fabric.mcp.v1 from a
result's extensions after the descriptor's extension check, when the
descriptor's run_result schema names the key under properties. Only
adapter-owned facts with source reported and collector adapter are kept;
a malformed or forged fact reads invalid_report, an omitted one
fact_omitted, an omitted key key_omitted, and a key over 64 KiB
too_large. A reported server the plan does not configure becomes a
harness entry. tool_names keeps 64 sorted names and counts the rest in
a new tool_names_truncated marker, added to the schema and both readers.
Ingestion never changes the run's status or error.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
A what_ran could not say which harness build ran. Six adapters now
declare nemo_fabric.versions.v1 and report their package version and the
harness name and version from a source that names the build that ran:

- Claude Code: claude_code_version from the CLI's init message.
- Codex: the thread's cli_version from one bounded thread/read request.
- Hermes: get_version_info(), a blocking call that runs git, on a daemon
  thread with a 5 second limit.
- OpenClaw: the --version check, or an attached gateway's /startupz
  version, both already read at startup.
- Deep Agents and mini-swe-agent: package metadata, accepted only when
  the distribution installed the module the adapter loaded.

A shared helper builds the report, applies core's string length rule,
and runs blocking calls with at most one outstanding probe per runtime;
stopping a runtime never waits for it. A source that times out, fails or
answers nothing reads a state with a reason, never a substitute value.
The adapter catalog is regenerated for the six changed descriptors.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
what_ran.models.<role>.served stayed unsupported for Claude Code even
though each assistant message names the model that answered.

The Claude Code adapter now reports, for the role it runs (default, or
the sole configured role), the one distinct model named by this
invocation's main-thread assistant messages. Messages with a
parent_tool_use_id belong to subagents and are skipped, and so are
Claude Code's <synthetic> API-error messages. Two distinct models read
not_attributed, none reads empty_response, a failed stream reads
collection_failed, and every invocation starts from its own messages.
Tests feed saved Claude Code CLI streams through the SDK's parser.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
The SDK guide and the integration reference said every adapter-reported
fact reads key_not_declared. They now name the six adapters that report
harness versions, the Claude Code served-model rule, the states a report
key can produce and the tool_names cap. The adapter tutorial and the
build-adapter skill show adapter authors how to declare and fill
nemo_fabric.versions.v1.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Regenerated with just docs for the new report-key constants and the tool_names_truncated field.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
NOOA, NOOA Bench, OpenHands and Remote Agent left adapter.package_version
at key_not_declared, so a run with them could not say which adapter
build ran. Each now declares nemo_fabric.versions.v1 and attaches its
installed package version to every result. These adapters have no
harness version or served-model source yet, so those facts read
unsupported with reason no_source. The catalog is regenerated.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Cline, Droid, Kilo Code, OpenCode, Pi and Qwen Code left
adapter.package_version at key_not_declared. A shared
withPackageVersion wrapper in the TypeScript common package reads the
adapter's own package.json synchronously at start and adds
nemo_fabric.versions.v1 to every result, with the harness and served
model facts unsupported/no_source until their sources land. Each CLI
wraps its runtime, each descriptor declares the key, and the catalog is
regenerated. A catalog test checks that all bundled descriptors declare
the key.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
The SDK guide and the integration reference named only the six adapters with a harness version source. The TypeScript common README documents withPackageVersion.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
The Claude and Hermes adapters attach nemo_fabric.versions.v1 to every
result, and core rejects a result extension that the descriptor's
run_result schema does not declare. The Harbor SWE-bench copies of both
descriptors lacked the block, so runs through them failed. A new test
finds every checked-in copy of a bundled descriptor and checks that it
declares the key.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
display_version drops the commit and the dirty marker of a source
checkout, so two different Hermes builds could report the same version.
Report derived_version, which Hermes's own --version output uses.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
The regenerated references also picked up changes that come from the
base branch, such as new FabricError variants, the telemetry field type
and page positions. Restore those pages so the branch carries only the
what_ran pages for the new report keys.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
BlockingProbe marked a probe as running before starting its thread. If
the start raised, nothing cleared the mark, and every later probe in the
runtime timed out at once. Clear the mark and re-raise.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Each adapter knows its harness name as a constant, so no collection
technique stands behind it. The names reused the version's method, such
as harness_init_message or package_metadata, which claimed a source the
name never came from. Report them with adapter_report, as the design
requires for an adapter fact with no technique behind it.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Wrap the Strands runtime with the existing version reporter so its declared result key has an adapter-version producer. Keep harness and served-model facts unsupported.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Declared adapter evidence can fail normalization. State that condition before describing nullable usage fields; the later failure paragraph already explains the retained raw evidence.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
@mnajafian-nv
mnajafian-nv marked this pull request as draft October 27, 2026 02:33
Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
@mnajafian-nv

Copy link
Copy Markdown
Contributor Author

This PR preserves the Codex failed-turn usage approach. I’m closing the current branch so future work can follow the shared accounting design.

This branch was previously deployed

1 inactive deployment
fern — 930984bd Deployed Oct 27, 2026 by copy-pr-bot[bot] via Preview docs #2625
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