Skip to content

feat(tui): checkpoint live provider catalogs and routed usage - #5726

Draft
Hmbown wants to merge 8 commits into
mainfrom
feat/openrouter-baseten-live-catalog-20260829
Draft

feat(tui): checkpoint live provider catalogs and routed usage#5726
Hmbown wants to merge 8 commits into
mainfrom
feat/openrouter-baseten-live-catalog-20260829

Conversation

@Hmbown

@Hmbown Hmbown commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Status

Draft integration checkpoint. Slice A gate repair (2026-08-30) has landed on this branch; see the receipts below. Remaining red is one founder-gated item (CodeQL dismissal packet posted as a PR comment).

Included

  • live catalog plumbing and provider-scoped route identity
  • Baseten compatible-host discovery and reviewed pricing path
  • immutable routed-usage envelopes through Engine and Runtime storage
  • dispatch-origin settlement for subagents crossing session replacement
  • durable failed-before-turn classifier settlement
  • picker/runtime-web pagination and catalog presentation coverage

Slice A repair receipts (2026-08-30, commits 84d64a8, b6a14d0, 9f381e0)

  • Clippy: the real count was 8 findings, not 17 — all fixed (large_enum_variant boxed, needless_return, doc_lazy_continuation, obfuscated_if_else). CI Lint + Check formatting now pass.
  • Stack-overflow SIGABRTs (runtime_api x2): oversized debug-build futures on the 2MiB libtest stack; pass with RUST_MIN_STACK=16MiB. Structural note recorded.
  • opencode_zen wire-route regression (Responses/AnthropicMessages vs ChatCompletions): fixed via route resolver alignment.
  • Guardian/kernel usage-to-cost accounting (2 tests + Safety-gate denial test): fixed; 7/7 guardian family green.
  • runtime_web drift guard: realigned to the paginated collectProviderModelPages contract (the rewrite was correct; the guard pinned the old URL shape). node --test 36/36.
  • PowerShell-nonportable subagent tests: fixed; Test (windows-latest) passes.
  • CodeQL: 14 new high → 2 remaining (both lib.rs session-id display through truncate_id; dismissal packet as PR comment — founder-gated).

Hosted check state (head 9f381e0)

Pass: Lint, Safety gate, Test (ubuntu/windows), Version drift, link, integrations, DCO, npm smoke, ohos check, GitGuardian, all CodeQL Analyze lanes. Pending at last sweep: Test (macos-latest). Fail: CodeQL aggregate (the 2 documented alerts only).

Still true (unchanged scope)

  • the Baseten offline seed needs source/provenance review against the authenticated workspace catalog
  • no authenticated OpenRouter/Baseten canary, artifact, installed-product smoke, billing proof, or founder acceptance has been supplied
  • visible synthetic Failed-turn semantics and the late-usage sidecar namespace still need product/API review

No-Issue: long-lived integration checkpoint tracked in the Ops takeover plan; slice receipts inline above.

Preserve the dependency-coupled OpenRouter/Baseten catalog, route-envelope, pricing, usage-accounting, and UI integration as a reviewable checkpoint. This is not a completion claim: two runtime_api tests still abort with stack overflow, Clippy reports 17 findings, and authenticated provider/CI/product proof remains outstanding.\n\nIncludes the completed Fable dispatch-origin accounting fix and the completed Opus failed-before-turn settlement fix, reconciled by the primary integrator.\n\nCo-authored-by: Claude Fable 5 <noreply@anthropic.com>
Comment thread crates/tui/src/cost_status.rs Fixed
Comment thread crates/tui/src/runtime_threads/tests.rs Fixed
CodeWhale Bot added 3 commits August 30, 2026 01:08
…route tests

CI-form clippy repairs on the checkpoint head:
- box MailboxMessage::TokenUsage.route (large_enum_variant) with call-site
  and test updates in subagent_routing and mailbox
- needless_return in session_manager lock-file open, doc_lazy_continuation
  in translation, obfuscated_if_else in provider_lake
- route resolver + provider lake alignment for the opencode_zen wire-route
  expectations (Responses/AnthropicMessages vs ChatCompletions)

Verified locally:
- cargo test -p codewhale-tui --locked --lib: 11596 passed, 6 failed — the 6
  are the pre-existing main-baseline sandbox::read_guard symlink family that
  #5724 makes whole-fn-unix; zero Slice-A regressions
- auto_review_guardian family 7/7 (accounting + denial + cache replay)
- web vitest run of crates/tui/src/runtime_web/app.test.mjs: 28/28
- CI-form clippy clean (previous session)

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
…ctor

The new-thread dialog now loads provider catalogs through
collectProviderModelPages (bounded pages, cursor-progress checks, injected
fetch boundary). The drift guard still pinned the pre-pagination single-shot
URL shape and failed on the rewritten app.mjs. Pin the new contract: dialog
calls collectProviderModelPages(provider.id) and the wire endpoint remains
/v1/providers/<encoded id>/models.

Also rustfmt two files from the previous gate-repair commit (CI 'Check
formatting' failure).

Verified: node --test crates/tui/tests/runtime_web_client.test.mjs —
pass 36, fail 0. cargo fmt --all -- --check clean.

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
- runtime_api session tests: build request URLs with the loopback host
  spelled literally (127.0.0.1:{port}) instead of an opaque {addr} variable,
  so the cleartext-transmission analysis can prove the request never leaves
  the host. Behavior unchanged; the listeners already bind 127.0.0.1.
- cost_status / runtime_threads anti-leak assertions: stop interpolating the
  credential fragment into the panic message — the assertion message must
  not itself become the logging sink it guards against.

Verified: cargo check -p codewhale-tui --tests --locked clean; 194 passed /
0 failed across cost_status + runtime_threads filters; cargo fmt clean.

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
@Hmbown

Hmbown commented Aug 30, 2026

Copy link
Copy Markdown
Owner Author

CodeQL aggregate — per-alert disposition (Slice A)

The 14 new high alerts are handled in two classes:

Fixed in code (9f381e00e + fmt b6a14d0c2) — 12 alerts:

  • 10 × runtime_api/tests.rs cleartext-transmission: loopback test servers whose {addr} variable hid the 127.0.0.1 binding from the analyzer. URLs now spell the loopback host literally (http://127.0.0.1:{port}/…). Behavior unchanged — the listeners always bound 127.0.0.1.
  • 2 × anti-leak assertions (cost_status.rs, runtime_threads/tests.rs) that interpolated the credential fragment into the assert panic message — the message itself was the logging sink it guarded against. Messages now name the check, not the secret.

Founder-dismissal packet — the remaining 2 (lib.rs:7777, lib.rs:8141, cleartext-logging of validated_session_id):

  • Both sites are the CLI session picker / fork output printing the user's own sessions to their own terminal.
  • The printed ids pass through truncate_id — the full id never renders.
  • Session ids are local file identifiers, not credentials; printing them for resume UX is the product feature (Codex's picker does the same).
  • Recommendation: dismiss both as false positive with this reasoning. Dismissal stays founder-gated per the security-surface rule — no unilateral action taken.

No gate weakening: no query config changes, no inline suppressions, no dismissals by the agent.

CodeWhale Bot added 2 commits August 30, 2026 12:59
… stack

The Runtime API test harness ran its whole setup (Config load via
toml::de visit_map frames, manager construction) and every axum handler
on the 2 MiB libtest thread. Config load under a profile and the
thread-lifecycle path marginally overflowed that stack in debug builds,
aborting the whole lib suite with SIGABRT; CI masked it with
RUST_MIN_STACK=16MiB.

The harness now builds and serves on a dedicated thread sized with
CODEWHALE_MAIN_STACK_BYTES (16 MiB, matching lib.rs runtime workers and
the .cnb.yml gate), with the test's sealed env scope adopted onto that
thread via env_scope_ticket/join_env_scope so Config::load env reads
never block on the mutex the sealing test holds while awaiting setup.
The libtest thread keeps only the test body and its HTTP client.

Verified with no RUST_MIN_STACK override: the previously aborting
reload_config/lifecycle filters and the provider_lake/catalog/guardian/
kernel filters all pass (279 passed; 0 failed).

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
Hmbown added a commit that referenced this pull request Sep 8, 2026
Bind provider catalogs to provider kind, configured identity and endpoint.
Keep account rosters in memory, reject superseded refreshes, and preserve
frozen admission quotes across every accounting consumer. Route runtime,
picker, inventory and API defaults through the same catalog authority.

Keep parent and auxiliary usage distinct; retain compaction usage through
failure/cancellation and deduplicate metadata replay. Preserve healthy
transcripts under ledger damage, retire deleted origins across processes,
reject stale snapshot/checkpoint saves, and retain late leased receipts at
terminal settlement. Complete Runtime model pagination without truncation.
Preserve current guardian re-review behavior and explicit model choices.

Validation on this isolated 0d3433c-based worktree:
- Selected codewhale-tui lib suite: 3474 passed, 0 failed, 8659 skipped.
- codewhale-config lib: 649 passed, 0 failed, 1 skipped.
- codewhale-protocol lib: 68 passed, 0 failed.
- Runtime browser JavaScript: 36 node +29 Vitest passed, 0 failed.
  All 16 direct web dependencies match the worktree lockfile.
- 4256 passing tests total across these separate scopes; no full-workspace
  test claim. First TUI run 3464/8 retained, then all 8 failures repaired.
- Final cargo check of TUI/config/protocol with --tests passed.
- cargo fmt --all -- --check and scoped git diff --check passed.
- Three guard-removal controls failed as expected (0/3), including actual
  deleted-origin cost accrual, duplicate gaps and overwritten late receipts;
  all source hashes restored, then the selected suite passed again.
  Separate browser pagination negative control failed as expected (0/1).
- Required root npm test and npm run check:web both failed: Missing script.
  The root package defines neither command. Logs retained; no gate claimed.

All request tests used isolated local fixtures on macOS. No real provider
call, hosted CI rerun, public push, merge, deployment or billing operation.
Evidence: /private/tmp/cw-5726-verification-20260907/REPORT.md

Harvested from PR #5726 by @Hmbown.
Original feature commit: 1a03b23
Donor head: 04ba303
Scoped source migration; stale main-sync history was not imported.

Refs #5726, #5848

Co-authored-by: Hmbown <101357273+Hmbown@users.noreply.github.com>
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.

2 participants