Skip to content

fix(chat): report the service tier a run resolved to - #164

Merged
devswha merged 1 commit into
mainfrom
fix/expose-session-service-tier
Sep 16, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/expose-session-service-tier

Conversation

@devswha

@devswha devswha commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Refs #160.

The gap

The app pins the model, the reasoning effort and the model chain per run, and reports all three. It never named the service tier.

A measured app session recorded this at startup:

APP  service_tier_change    → "priority"
CLI  (no record)

while:

$ grep -rniE 'serviceTier|service_tier' server/ shared/ src/
(no functional match)

The app could not display, audit or explain the tier its own runs billed at, and the user's ~/.gjc/agent/config.yml does not set one either — so nothing on either side of the boundary could account for it.

Why it matters

The runtime's own schema is explicit about the cost meaning:

Processing priority hint (none = omit). OpenAI accepts the tier values directly; Anthropic realizes priority as speed: "fast" on supported Opus models.

So the tier changes what a turn costs, on the same model, at the same effort. Reporting the effort but not the tier tells half the story.

What this does

session.serviceTier was already a public getter, one call away, beside the thinkingLevel that gjc-session-state.ts has read since it was written. This:

  • reads it into the same session snapshot (server/gjc-session-state.ts),
  • validates it the same way as every other reported string on the client (src/contexts/sessionStatusSnapshot.ts, including the equality check that decides whether to re-render),
  • renders it in the Agent sidebar's Environment block, which already documents itself as "reports, not controls" and already omits a row whose fact is unknown.

agentSidebar.environment.serviceTier added to all 10 locales; scripts/check-locale-parity.test.mjs passes.

Absent stays absent

undefined is the runtime saying "omit service_tier", which is its own default (the serviceTier schema default is none). No row is rendered rather than one claiming a tier the request never carried. Same for a blank or wrongly typed value.

Scope

This closes the visibility half of #160. Making the tier selectable needs a Settings surface and is deliberately not in this PR — #160 stays open for it.

Verification

node --test server/gjc-session-state.test.ts                          11 pass  0 fail
node --test src/contexts/sessionStatusSnapshot.test.ts                11 pass  0 fail
bun test  AgentSidebarEnvironment.dom.bun.test.tsx                     9 pass  0 fail
node --test scripts/check-locale-parity.test.mjs                       2 pass  0 fail
npm run check:identity                                                passed
npx tsc -p tsconfig.json --noEmit / -p server/tsconfig.json --noEmit  clean
npx eslint <changed files>                                            clean

New tests cover: the tier is read off the session; an omitted or blank tier stays absent; a throwing tier getter does not take the rest of the snapshot down (this runs inside the turn's event path); the client drops a wrongly typed tier; the tier participates in the snapshot equality check; and both render cases in the DOM.

The app pins the model, the reasoning effort and the model chain per run and
reports all three, but never named the service tier. A measured app session
recorded `service_tier_change: "priority"` at startup while the string
`serviceTier` appeared nowhere in server/, shared/ or src/ - so the app could
not display, audit or explain the tier its own runs billed at.

That is not cosmetic. The runtime's schema is explicit: `priority` is realized
on Anthropic as `speed: "fast"` on supported Opus models, so the tier changes
what a turn costs.

`session.serviceTier` was already a public getter one call away, beside the
reasoning level this file has read since it was written. This reads it into the
same snapshot, validates it the same way on the client, and renders it in the
Agent sidebar's Environment block - which already documents itself as reports
rather than controls, and already omits a row whose fact is unknown.

Absent stays absent. `undefined` is the runtime saying "omit service_tier",
which is its own default, so no row is rendered rather than one claiming a tier
the request never carried.

Refs #160
@devswha
devswha merged commit e79924e into main Sep 16, 2026
6 checks passed
@devswha
devswha deleted the fix/expose-session-service-tier branch September 16, 2026 17:46
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