Skip to content

feat(ops): price a claimed order's measured usage with --models (XWING-2358) - #111

Merged
smith-xyz merged 3 commits into
traust-security:developmentfrom
smith-xyz:feat/w10-spend-settle
Oct 27, 2026
Merged

smith-xyz merged 3 commits into
traust-security:developmentfrom
smith-xyz:feat/w10-spend-settle

Conversation

@smith-xyz

Copy link
Copy Markdown
Contributor

Plan: plans/traust-standardization/0-continuous-ops/11-shaun-spend-sources-spike.md (part)

Plan 11, Revised (2026-10-27), step A (engine half). Core: traust-security/traust-core#230. traust follows.

What changed

  • The runner already parses a command's last stdout line as a JobResult and passes it to OpsService.complete. Core's JobResult now carries usage, so a session's measured usage reaches complete with no runner change. Admission and the controller are untouched.
  • traust-engine <op> --models <model-registry.yaml> (a common flag, next to --feeds) registers core's model catalog, so a completed order's usage is priced as its spend. Without the flag the order still completes, and core records the gap as spend-unpriced in the run manifest.
  • The core pin is moved to traust-core#230's head (603aabf): [tool.uv.sources] rev, with uv lock.

Parity

Behaviour Home
a command's JobResult completes its order unchanged (runner.outcome → ops.complete); it now carries usage
pricing core ModelCatalog, registered by --models

Legacy files

None.

Behaviour changes

Before After Why
claim and record never recorded spend with --models, an order whose command answers its usage gets priced spend in the same transaction as its completion; without it, the order completes and the gap is in its manifest plan 11 step A

Changed tests

None (one new parametrized test in tests/test_ops_runner.py).

  • A person reviewed each changed test and the behaviour change is intended

Tests

  • test_a_session_that_answers_its_usage_settles_it_as_the_orders_spend[priced | no registry]: traust-engine claim end to end on SQLite. Reply text is followed by a JobResult carrying usage; the test checks spend in the order's lane at the registry price, or the order completed with the gap in its run manifest.
  • uv run pytest tests -n auto: 1326 passed, 26 skipped.

Net LOC

src +7 (net +7); tests +46; pin and lock ±5.

@smith-xyz
smith-xyz requested a review from a team as a code owner October 27, 2026 17:18
@openshift-ci

openshift-ci Bot commented Oct 27, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: smith-xyz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 27, 2026
@smith-xyz

Copy link
Copy Markdown
Contributor Author

Supervisor sign-off (on Shaun's behalf, autonomous review loop). Plan 11 A (part): the runner already passes the session's last-line JobResult (now carrying usage) to complete; adds --models <model-registry.yaml> so engine runs can price spend. Admission and controller untouched. Supervisor merged development and re-pinned core to efd2797 (core#230); CI green.

@smith-xyz
smith-xyz merged commit 6c78fae into traust-security:development Oct 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant