Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(signals): pin an OpenAI service tier on one scout model slice (#96171)

Andrew Maguirecb17f6df1dd4
diff --git a/products/desktop/packages/agent/src/server/agent-server.configure-environment.test.ts b/products/desktop/packages/agent/src/server/agent-server.configure-environment.test.ts
index cc5d9bbc3808..015a86e67c11 100644
--- a/products/desktop/packages/agent/src/server/agent-server.configure-environment.test.ts
+++ b/products/desktop/packages/agent/src/server/agent-server.configure-environment.test.ts
@@ -464,7 +464,9 @@ describe("AgentServer.configureEnvironment on the Go ai-gateway", () => {
}
});
- const buildServer = (): TestableServer =>
+ const buildServer = (
+ overrides: { serviceTier?: "default" | "priority" | "flex" } = {},
+ ): TestableServer =>
new AgentServer({
port: 0,
jwtPublicKey: "test-key",
@@ -474,6 +476,7 @@ describe("AgentServer.configureEnvironment on the Go ai-gateway", () => {
mode: "background",
taskId: "test-task-id",
runId: "test-run-id",
+ ...overrides,
}) as unknown as TestableServer;
const parseBlob = (headerLines: string): Record<string, unknown> => {
@@ -572,6 +575,19 @@ describe("AgentServer.configureEnvironment on the Go ai-gateway", () => {
]);
});
+ // The gateway writes the tier into the OpenAI body from this header, so a
+ // run that loses it silently runs on the standard queue and a flex trial
+ // measures nothing. Codex-only: the Claude header lines never carry it.
+ it("sends a configured service tier as X-PostHog-Service-Tier on the OpenAI record", () => {
+ const env = buildServer({ serviceTier: "flex" }).configureEnvironment({
+ originProduct: "signal_report",
+ aiStage: "scout",
+ });
+
+ expect(env.openaiCustomHeaders?.["X-PostHog-Service-Tier"]).toBe("flex");
+ expect(env.anthropicCustomHeaders).not.toContain("X-PostHog-Service-Tier");
+ });
+
it("keeps non-signals products on their existing ai_product name", () => {
const env = buildServer().configureEnvironment({ isInternal: true });
diff --git a/products/desktop/packages/agent/src/server/agent-server.ts b/products/desktop/packages/agent/src/server/agent-server.ts
index 673a917c2779..2cbc555dbb26 100644
--- a/products/desktop/packages/agent/src/server/agent-server.ts
+++ b/products/desktop/packages/agent/src/server/agent-server.ts
@@ -5182,6 +5182,13 @@ ${commonInstructions}
};
customHeaders = buildPosthogPropertiesHeaderLines(properties);
openaiCustomHeaders = buildPosthogPropertiesHeaderRecord(properties);
+ // The Go gateway writes this into the OpenAI body's `service_tier`, which
+ // is the only way a Codex run reaches the flex or priority queue: Codex
+ // itself omits a tier its model catalogue does not advertise. Codex-only,
+ // so it rides the OpenAI record; the Claude path has no tier concept.
+ if (this.config.serviceTier) {
+ openaiCustomHeaders["X-PostHog-Service-Tier"] = this.config.serviceTier;
+ }
} else {
customHeaders = buildPosthogScopedPropertyHeaderLines(
gatewayProperties,
diff --git a/products/desktop/packages/agent/src/server/types.ts b/products/desktop/packages/agent/src/server/types.ts
index 0c836c03432e..23eac6ab94bf 100644
--- a/products/desktop/packages/agent/src/server/types.ts
+++ b/products/desktop/packages/agent/src/server/types.ts
@@ -64,7 +64,10 @@ export interface AgentServerConfig {
/**
* Codex-only OpenAI service tier for the run's turns. "flex" is the cheaper,
* slower queue; "priority" the faster one; "default" pins standard routing.
- * Codex omits a tier its model catalogue doesn't advertise for the model.
+ * Sent two ways: as `serviceTier` on the Codex thread, which Codex omits for
+ * a model its catalogue does not advertise the tier for, and as the
+ * `X-PostHog-Service-Tier` header on every request to the Go gateway, which
+ * writes it into the body itself.
*/
serviceTier?: ServiceTier;
contextWindow?: "200k" | "1m";
diff --git a/products/signals/backend/agent_runtime.py b/products/signals/backend/agent_runtime.py
index 0dc3561ca49a..6cfc6cdf563d 100644
--- a/products/signals/backend/agent_runtime.py
+++ b/products/signals/backend/agent_runtime.py
@@ -90,6 +90,12 @@ class AgentRuntime:
DEFAULT_RUNTIME = AgentRuntime()
+# The OpenAI service tiers a pin may name, mirroring the agent server's `ServiceTier` enum. The
+# agent server sends the value verbatim as the gateway's `X-PostHog-Service-Tier`, which fails
+# closed on anything else, so an unknown value is dropped here (standard queue) rather than
+# threaded into run state where it would 400 every request of the run.
+KNOWN_SERVICE_TIERS = frozenset({"default", "priority", "flex"})
+
# The Codex trial config (used by the local `analyze_report --codex` override).
CODEX_RUNTIME = AgentRuntime(runtime_adapter="codex", model="gpt-5.5", reasoning_effort="xhigh")
@@ -128,11 +134,12 @@ def _parse_runtime(step_block: object) -> AgentRuntime:
value = step_block.get(key)
return value if isinstance(value, str) and value else None
+ service_tier = _str_or_none("service_tier")
return AgentRuntime(
runtime_adapter=_str_or_none("runtime_adapter"),
model=_str_or_none("model"),
reasoning_effort=_str_or_none("reasoning_effort"),
- service_tier=_str_or_none("service_tier"),
+ service_tier=service_tier if service_tier in KNOWN_SERVICE_TIERS else None,
)
diff --git a/products/signals/backend/scout_harness/AGENTS.md b/products/signals/backend/scout_harness/AGENTS.md
index 2a14c3d89a6c..4bc11eaeb067 100644
--- a/products/signals/backend/scout_harness/AGENTS.md
+++ b/products/signals/backend/scout_harness/AGENTS.md
@@ -117,7 +117,7 @@ In production it is driven by `SignalsScoutCoordinatorWorkflow` (periodic tick e
`harness_prompt_version` / `report_channel` (`none`/`emit`/`edit`/`both`) / `skill_origin` / `github_guidance` / `business_knowledge_maintained` always are:
together they pin down which instructions the run was given, which is the thing an eval or A/B has to hold constant. The last four are composition forks the build alone doesn't capture, since the same prompt build renders different sections depending on channel, skill origin, whether a read-only GitHub token could be minted, and whether the team's knowledge base looks maintained (flag + upkeep, per `business_knowledge.is_maintained_for_team`).
Each is unrecoverable after the fact (the prompt has no version history, a skill's `allowed_tools` can be edited, a seeded canonical row flips to `custom` the moment a team edits it taking every past run's origin with it, and the flag / source state behind the last two can change between runs), which is why they are stamped rather than resolved at read time.
- `model` / `runtime_adapter` / `reasoning_effort` appear only when something overrode the agent-server default — a `SignalScoutConfig.model` pin (honored while the `scouts-model-config` dogfood flag is on for the team, and the top layer of `model_selection.resolve_scout_model`), the `scouts-model-selection` gate, or a runtime pin — so their absence is meaningful.
+ `model` / `runtime_adapter` / `reasoning_effort` appear only when something overrode the agent-server default — a `SignalScoutConfig.model` pin (honored while the `scouts-model-config` dogfood flag is on for the team, and the top layer of `model_selection.resolve_scout_model`), the `scouts-model-selection` gate, or a runtime pin — so their absence is meaningful. `service_tier` (the OpenAI queue a Codex run asked for: `flex`, `priority`, or `default`) follows the same rule and travels with the model it was configured beside: the selected slice's own object form, or the pipeline pin's when the pin's model runs, never inherited across models, and dropped on a claude runtime. That is what lets one slice trial flex against the remainder's standard queue on the same model.
All five are attached to both lifecycle events via `_attach_run_shape_props`, since that is where the A/B readout happens, and `github_guidance` and `business_knowledge_maintained` are resolved in `arun_signals_scout` rather than inside `_spawn_and_run` so the failure and cancellation paths can report them too.
New runner-known run dimensions belong here, not grown as ad-hoc columns.
The nested `derived` object is written once at finalize by `derived_metadata.py` and holds booleans the harness computes from the run's own settled output (`has_emit_report`, `has_edit_report`, `has_self_improvement`, `has_chart`, `has_self_validation`), so "what kind of run was this?" is a field lookup rather than a parse of the prose `summary`.
@@ -126,7 +126,7 @@ In production it is driven by `SignalsScoutCoordinatorWorkflow` (periodic tick e
A missing `derived` region is unknown rather than all-false: the run predates the field, died before finalize, or its stamp failed (best-effort and logged, since observability must not fail a run that already committed its output). The flags read the authored reports' current state at finalize rather than an emit-time snapshot, so a title or chart changed after the emit is what lands; the emit-time record stays on the report lifecycle events.
- Each run emits scout-owned lifecycle analytics events (best-effort, keyed on the team):
`signals_scout_run_started` (the run cleared the guards and a TaskRun exists), `signals_scout_run_finished` (terminal: `completed`/`failed`/`cancelled` + runtime + emit count), and `signals_scout_run_reaped` (a stranded orphan was reaped by `_self_heal_stale_runs`). They join on `run_id`/`task_run_id` and are the event-derived (no-warehouse-lag) basis for throughput, stall, and worker-death alerting — a `started` with no `finished` is a run that died before finalize; a reaped run emits no `finished`.
- When the model resolution (a config pin, the `scouts-model-selection` gate, or a runtime pin) routes the run, `started` and `finished` also carry `model` / `runtime_adapter`, so run outcomes are sliceable by model without joining through `$ai_generation`; absence means the agent-server default served it.
+ When the model resolution (a config pin, the `scouts-model-selection` gate, or a runtime pin) routes the run, `started` and `finished` also carry `model` / `runtime_adapter` (and `service_tier` when a slice or pin asked for an OpenAI queue), so run outcomes are sliceable by model and queue without joining through `$ai_generation`; absence means the agent-server default served it.
A `finished` run that died at the per-turn poll wall also carries the turn-log diagnostics from `TurnPollTimeout.diagnostics()` (`poll_timeout_stage` + elapsed/stale/line counts), because every wall failure raises one error string and the fleet's timeout rate is otherwise a single undifferentiated bucket: `no_turn_output` (the agent never emitted a turn-relevant line — it never got going), `stalled_after_output` (worked, then went quiet past the salvage window), `active_at_budget` (still streaming when the budget expired — the budget is the constraint, not the agent).
`signals_scout_fleet_synced` is the fleet-level companion, emitted from `fleet_sync.py` on the request path rather than per run — see that module's bullet above.
`signals_scout_config_auto_paused` fires once when a `(team, skill)` lane's failure-streak breaker trips (see the run-lifecycle bullet above) — the alertable signal for a wedged lane, which is otherwise invisible in a stream of individually-unremarkable `failed` runs.
diff --git a/products/signals/backend/scout_harness/model_selection.py b/products/signals/backend/scout_harness/model_selection.py
index 7dadf5398c16..3995ca099734 100644
--- a/products/signals/backend/scout_harness/model_selection.py
+++ b/products/signals/backend/scout_harness/model_selection.py
@@ -34,10 +34,13 @@ distinct_id) is the single source of truth; a team with no entry runs entirely o
that scout's runs (0..1) it serves. `signals-scout-team-self-driving` above runs 20% on glm-5.2,
20% on gpt-5.5, and the remaining 60% on the agent-server default. `"*"` is the fallback
distribution for scouts not listed explicitly. A model's value may instead be an object
- `{"fraction": 0.2, "runtime_adapter": "codex", "reasoning_effort": "high"}` to pin its runtime
- (and optionally the reasoning effort) explicitly; with the bare-number form the runtime is
- inferred from the id (`claude-*` → `claude`, everything else → `codex`) and the effort is left
- unset (agent-server default).
+ `{"fraction": 0.2, "runtime_adapter": "codex", "reasoning_effort": "high", "service_tier": "flex"}`
+ to pin its runtime (and optionally the reasoning effort and the OpenAI service tier) explicitly;
+ with the bare-number form the runtime is inferred from the id (`claude-*` → `claude`, everything
+ else → `codex`) and the effort and tier are left unset (agent-server default). A tier on a slice
+ is what makes a same-model A/B on queueing possible: one explicit `gpt-5.6-terra` slice pinned to
+ `flex` against the unallocated remainder falling through to the `signals-pipeline-models` pin for
+ the same model on the standard queue.
- The reserved `"default"` key inside a scout's map names the model the *remaining* (unallocated)
runs use instead of the agent-server default — its value is a model-id string, not a fraction.
@@ -62,9 +65,11 @@ from dataclasses import dataclass
import posthoganalytics
+from posthog.dataclasses import frozen
from posthog.exceptions_capture import capture_exception
from posthog.models.team.team import Team
+from products.signals.backend.agent_runtime import KNOWN_SERVICE_TIERS
from products.tasks.backend.facade.run_config import get_models_for_runtime_adapter
SCOUTS_MODEL_FLAG = "scouts-model-selection"
@@ -100,10 +105,12 @@ WILDCARD = "*"
DEFAULT_MODEL_KEY = "default"
# Keys recognized in the object form of a model entry (the alternative to a bare fraction):
-# `{"fraction": <0..1>, "runtime_adapter": "claude"|"codex", "reasoning_effort": "high"}`.
+# `{"fraction": <0..1>, "runtime_adapter": "claude"|"codex", "reasoning_effort": "high",
+# "service_tier": "flex"}`.
FRACTION_KEY = "fraction"
RUNTIME_ADAPTER_KEY = "runtime_adapter"
REASONING_EFFORT_KEY = "reasoning_effort"
+SERVICE_TIER_KEY = "service_tier"
# The two agent runtimes the agent server exposes. A model id alone can't be routed — the server
# derives its provider (Anthropic / OpenAI) from the runtime — so every routed model also carries a
@@ -122,6 +129,11 @@ _KNOWN_RUNTIME_ADAPTERS = frozenset({RUNTIME_ADAPTER_CLAUDE, RUNTIME_ADAPTER_COD
# agent-server default) rather than threaded into the run state where it could fail the run.
_KNOWN_REASONING_EFFORTS = frozenset({"low", "medium", "high", "xhigh", "max"})
+# The OpenAI service tiers a payload may pin, mirroring the agent server's `ServiceTier` enum. Same
+# defensive posture again: an unknown value is dropped (tier unset, standard queue) rather than
+# threaded into the run state where it could fail the run. Shared with the pipeline pin parser.
+_KNOWN_SERVICE_TIERS = KNOWN_SERVICE_TIERS
+
@dataclass(frozen=True)
class ScoutModel:
@@ -133,12 +145,16 @@ class ScoutModel:
the LLM provider from the runtime, and a model id handed over with no runtime can't be routed
(it silently falls back to the server default, which is the bug this resolution exists to
avoid). `reasoning_effort` is the optional per-model effort pin from the payload's object form;
- `None` keeps the agent-server default effort.
+ `None` keeps the agent-server default effort. `service_tier` is the optional OpenAI queue pin
+ from the same form (`flex` / `priority` / `default`); `None` means the slice asked for no queue,
+ and the tier never crosses from another model's pin, so a slice can A/B queueing against the
+ unallocated remainder running the same model on the `signals-pipeline-models` pin's tier.
"""
model: str | None
runtime_adapter: str | None
reasoning_effort: str | None = None
+ service_tier: str | None = None
def _infer_runtime_adapter(model_id: str) -> str:
@@ -255,72 +271,84 @@ def _team_scouts(payload: object, team_id: int, canonical_team_id: int) -> dict:
return scouts if isinstance(scouts, dict) else {}
-def _parse_model_spec(spec: object) -> tuple[float | None, str | None, str | None]:
- """A `(fraction, runtime_adapter, reasoning_effort)` from one model entry's value.
+@frozen
+class _ModelSpec:
+ """One parsed model entry: its fraction plus whichever pins the object form carried.
+
+ `fraction` is `None` for a malformed weight so the caller drops the entry. The pins are `None`
+ when absent or unrecognized, never a value the agent server can't honor.
+ """
+
+ fraction: float | None
+ runtime_adapter: str | None = None
+ reasoning_effort: str | None = None
+ service_tier: str | None = None
+
+
+def _known_str(value: object, known: frozenset[str]) -> str | None:
+ # `isinstance` first: an unhashable value (JSON array/object) would raise from the set
+ # membership test, and that escapes `_read_payload`'s guard and would fail the run.
+ return value if isinstance(value, str) and value in known else None
+
+
+def _parse_model_spec(spec: object) -> _ModelSpec:
+ """The fraction and pins from one model entry's value.
A model entry's value is either a bare number (its fraction; runtime inferred from the id,
- effort unset) or an object `{"fraction": <0..1>, "runtime_adapter": "claude"|"codex",
- "reasoning_effort": "high"}` that pins the runtime (and optionally the effort) explicitly.
- Returns `(None, ...)` for a malformed fraction (not a positive number, or a bool) so the caller
- drops the entry rather than failing the run. A `runtime_adapter` or `reasoning_effort` that
+ effort and tier unset) or an object `{"fraction": <0..1>, "runtime_adapter": "claude"|"codex",
+ "reasoning_effort": "high", "service_tier": "flex"}` that pins the runtime (and optionally the
+ effort and the OpenAI queue) explicitly. A malformed fraction (not a positive number, or a bool)
+ yields `fraction=None` so the caller drops the entry rather than failing the run. A pin that
isn't one of the known values (non-string, typo, unsupported) is ignored (treated as unset), so
- a payload typo can't route the run onto a runtime or effort the agent server can't honor.
+ a payload typo can't route the run onto a runtime, effort, or queue the agent server can't honor.
"""
- if isinstance(spec, dict):
- weight = spec.get(FRACTION_KEY)
- adapter_value = spec.get(RUNTIME_ADAPTER_KEY)
- effort_value = spec.get(REASONING_EFFORT_KEY)
- # `isinstance` first: an unhashable value (JSON array/object) would raise from the set
- # membership test, and that escapes `_read_payload`'s guard and would fail the run.
- adapter = adapter_value if isinstance(adapter_value, str) and adapter_value in _KNOWN_RUNTIME_ADAPTERS else None
- effort = effort_value if isinstance(effort_value, str) and effort_value in _KNOWN_REASONING_EFFORTS else None
- else:
- weight = spec
- adapter = None
- effort = None
+ if not isinstance(spec, dict):
+ return _ModelSpec(fraction=_parse_fraction(spec))
+ return _ModelSpec(
+ fraction=_parse_fraction(spec.get(FRACTION_KEY)),
+ runtime_adapter=_known_str(spec.get(RUNTIME_ADAPTER_KEY), _KNOWN_RUNTIME_ADAPTERS),
+ reasoning_effort=_known_str(spec.get(REASONING_EFFORT_KEY), _KNOWN_REASONING_EFFORTS),
+ service_tier=_known_str(spec.get(SERVICE_TIER_KEY), _KNOWN_SERVICE_TIERS),
+ )
+
+
+def _parse_fraction(weight: object) -> float | None:
if not isinstance(weight, int | float) or isinstance(weight, bool) or weight <= 0:
- return None, adapter, effort
- return min(1.0, float(weight)), adapter, effort
+ return None
+ return min(1.0, float(weight))
-def _scout_config(scouts: dict, skill_name: str) -> tuple[dict[str, float], dict[str, str], dict[str, str], str | None]:
- """The `(distribution, adapters, efforts, default_model)` for one scout from a team's scout map.
+def _scout_config(scouts: dict, skill_name: str) -> tuple[dict[str, _ModelSpec], str | None]:
+ """The `(specs, default_model)` for one scout from a team's scout map.
Looks up `scouts[skill_name]`, falling back to the `"*"` scout wildcard. The reserved `"default"`
string key is pulled out as `default_model` (the model for the unallocated remainder; `None` =
agent-server default); every other entry is a `model_id -> fraction | {fraction, runtime_adapter,
- reasoning_effort}` weight. `adapters` and `efforts` carry only the model ids whose runtime /
- effort was pinned explicitly in the payload; unpinned runtimes are inferred from the id at
- resolve time and unpinned efforts stay unset. Defensive — a missing/non-object scout entry,
- or a malformed weight (not a positive number, or a bool) is dropped rather than failing the run,
- so a typo can't crash a scout or route it unintended.
+ reasoning_effort, service_tier}` weight, parsed into a `_ModelSpec`. Unpinned runtimes are
+ inferred from the id at resolve time; unpinned efforts and tiers stay unset. Defensive — a
+ missing/non-object scout entry, or a malformed weight (not a positive number, or a bool) is
+ dropped rather than failing the run, so a typo can't crash a scout or route it unintended.
"""
raw = scouts.get(skill_name)
if not isinstance(raw, dict):
raw = scouts.get(WILDCARD)
if not isinstance(raw, dict):
- return {}, {}, {}, None
+ return {}, None
default_value = raw.get(DEFAULT_MODEL_KEY)
default_model = default_value if isinstance(default_value, str) and default_value else None
- distribution: dict[str, float] = {}
- adapters: dict[str, str] = {}
- efforts: dict[str, str] = {}
+ specs: dict[str, _ModelSpec] = {}
for model_id, spec in raw.items():
if model_id == DEFAULT_MODEL_KEY:
continue
if not isinstance(model_id, str) or not model_id:
continue
- fraction, adapter, effort = _parse_model_spec(spec)
- if fraction is None:
+ parsed = _parse_model_spec(spec)
+ if parsed.fraction is None:
continue
- distribution[model_id] = fraction
- if adapter is not None:
- adapters[model_id] = adapter
- if effort is not None:
- efforts[model_id] = effort
- return distribution, adapters, efforts, default_model
+ specs[model_id] = parsed
+ return specs, default_model
def _bucket(run_id: str) -> float:
@@ -334,20 +362,27 @@ def _bucket(run_id: str) -> float:
return int.from_bytes(hashlib.sha256(run_id.encode()).digest()[:8], "big") / 2**64
-def _select_model(run_id: str, distribution: dict[str, float], default_model: str | None) -> str | None:
+def _select_model(
+ run_id: str, specs: dict[str, _ModelSpec], default_model: str | None
+) -> tuple[str | None, _ModelSpec | None]:
"""Pick a model for this run from the scout's distribution, deterministically on `run_id`.
Walks the models in sorted-id order accumulating their fractions; the run's bucket falls into
exactly one model's slice, or past them all into the remainder → `default_model`. Sorted order
makes the assignment stable across runs/processes. If the fractions sum to ≥ 1 the remainder is
- empty and `default_model` simply never runs.
+ empty and `default_model` simply never runs. Returns the selected slice's spec alongside the
+ model, and `None` for the remainder: which branch picked the model is decided here, not
+ recovered from the model id, so a remainder that names the same model as a weighted slice
+ (`{"gpt-5.6-terra": {"fraction": 0.05, "service_tier": "flex"}, "default": "gpt-5.6-terra"}`)
+ stays the pin-free control instead of inheriting the slice's tier.
"""
cumulative = 0.0
- for model_id in sorted(distribution):
- cumulative += distribution[model_id]
+ for model_id in sorted(specs):
+ spec = specs[model_id]
+ cumulative += spec.fraction if spec.fraction is not None else 0.0
if _bucket(run_id) < cumulative:
- return model_id
- return default_model
+ return model_id, spec
+ return default_model, None
def resolve_scout_model(team: Team, skill_name: str, run_id: str, configured_model: str | None = None) -> ScoutModel:
@@ -367,12 +402,16 @@ def resolve_scout_model(team: Team, skill_name: str, run_id: str, configured_mod
return ScoutModel(model=configured_model, runtime_adapter=_runtime_adapter_for_pin(configured_model))
payload = _read_payload()
scouts = _team_scouts(payload, team.id, team.parent_team_id or team.id)
- distribution, adapters, efforts, default_model = _scout_config(scouts, skill_name)
- model = _select_model(run_id, distribution, default_model)
+ specs, default_model = _scout_config(scouts, skill_name)
+ model, spec = _select_model(run_id, specs, default_model)
if model is None:
return ScoutModel(model=None, runtime_adapter=None)
+ if spec is None:
+ # The `default` remainder carries no pins, even when a weighted slice names the same model.
+ return ScoutModel(model=model, runtime_adapter=_infer_runtime_adapter(model))
return ScoutModel(
model=model,
- runtime_adapter=adapters.get(model) or _infer_runtime_adapter(model),
- reasoning_effort=efforts.get(model),
+ runtime_adapter=spec.runtime_adapter or _infer_runtime_adapter(model),
+ reasoning_effort=spec.reasoning_effort,
+ service_tier=spec.service_tier,
)
diff --git a/products/signals/backend/scout_harness/runner.py b/products/signals/backend/scout_harness/runner.py
index d4becad0c22c..c3cd58e1f331 100644
--- a/products/signals/backend/scout_harness/runner.py
+++ b/products/signals/backend/scout_harness/runner.py
@@ -39,7 +39,7 @@ from products.signals.backend.scout_harness.limits import (
failure_streak_pause_threshold,
interval_runs_in_tolerance_window,
)
-from products.signals.backend.scout_harness.model_selection import resolve_scout_model
+from products.signals.backend.scout_harness.model_selection import RUNTIME_ADAPTER_CODEX, resolve_scout_model
from products.signals.backend.scout_harness.prompt import (
HARNESS_PROMPT_VERSION,
SignalScoutRunSummary,
@@ -323,19 +323,25 @@ async def arun_signals_scout(
runtime_adapter: str | None = scout_model.runtime_adapter
model: str | None = scout_model.model
reasoning_effort: str | None = scout_model.reasoning_effort
+ service_tier: str | None = scout_model.service_tier
elif agent_runtime.runtime_adapter:
runtime_adapter = agent_runtime.runtime_adapter
model = agent_runtime.model
reasoning_effort = agent_runtime.reasoning_effort
+ service_tier = agent_runtime.service_tier
else:
runtime_adapter = None
model = None
reasoning_effort = None
- # Resolved from the pipeline payload in every branch, unlike the triple above. The tier only
- # picks which OpenAI queue a Codex turn joins, so pairing it with a configured model can't
- # mis-route the way a mismatched runtime/model would, and Codex drops a tier its catalogue
- # doesn't advertise. A claude-runtime run ignores it.
- service_tier: str | None = agent_runtime.service_tier
+ service_tier = None
+ # The OpenAI queue travels with the model it was configured beside, like the rest of the
+ # triple: a slice's own tier, or the pipeline pin's when the pin's model runs. It never crosses
+ # to a model the operator did not pair it with (some reject the field outright), which is what
+ # lets one slice trial `flex` against the remainder's standard queue on the same model. Only a
+ # Codex turn joins an OpenAI queue, so a claude runtime drops it rather than stamping a tier the
+ # run never asked for onto the A/B readout.
+ if runtime_adapter != RUNTIME_ADAPTER_CODEX:
+ service_tier = None
# Resolved here rather than inside `_spawn_and_run` so the failure and cancellation paths below
# can report the same prompt shape the run actually got: a spawn that raises never returns, so a
# value resolved in there would be unavailable to exactly the runs whose shape matters most.
@@ -407,6 +413,7 @@ async def arun_signals_scout(
triggered_by=triggered_by,
model=model,
runtime_adapter=runtime_adapter,
+ service_tier=service_tier,
)
return RunResult(
run_id=str(run_id),
@@ -470,6 +477,7 @@ async def arun_signals_scout(
triggered_by=triggered_by,
model=model,
runtime_adapter=runtime_adapter,
+ service_tier=service_tier,
error_type=type(exc).__name__,
error_message=str(exc)[:300],
extra_properties=_poll_timeout_properties(exc),
@@ -531,6 +539,7 @@ async def arun_signals_scout(
triggered_by=triggered_by,
model=model,
runtime_adapter=runtime_adapter,
+ service_tier=service_tier,
)
raise
@@ -766,6 +775,7 @@ async def _spawn_and_run(
model=model,
runtime_adapter=runtime_adapter,
reasoning_effort=reasoning_effort,
+ service_tier=service_tier,
github_guidance=github_guidance,
business_knowledge_maintained=business_knowledge_maintained,
triggered_by=triggered_by,
@@ -786,6 +796,7 @@ async def _spawn_and_run(
triggered_by=triggered_by,
model=model,
runtime_adapter=runtime_adapter,
+ service_tier=service_tier,
)
session, result = await MultiTurnSession.start(
@@ -967,19 +978,22 @@ def _create_run_row(
model: str | None = None,
runtime_adapter: str | None = None,
reasoning_effort: str | None = None,
+ service_tier: str | None = None,
github_guidance: bool = False,
business_knowledge_maintained: bool = False,
triggered_by: str = TRIGGERED_BY_SCHEDULE,
) -> SignalScoutRun:
- # Stamp the routed model triple onto the row's `metadata` so "which model ran this?" is a
- # column read on the run API, not an analytics-event join. Keys are omitted (not null-valued)
- # on the default path, so their absence means the agent-server default served the run.
+ # Stamp the routed model triple (and the OpenAI queue it asked for) onto the row's `metadata`
+ # so "which model ran this?" is a column read on the run API, not an analytics-event join. Keys
+ # are omitted (not null-valued) on the default path, so their absence means the agent-server
+ # default served the run.
metadata: dict[str, Any] = {
key: value
for key, value in (
("model", model),
("runtime_adapter", runtime_adapter),
("reasoning_effort", reasoning_effort),
+ ("service_tier", service_tier),
)
if value is not None
}
@@ -1226,6 +1240,7 @@ def _capture_run_started(
triggered_by: str,
model: str | None = None,
runtime_adapter: str | None = None,
+ service_tier: str | None = None,
) -> None:
"""Emit the scout-owned run-started analytics event.
@@ -1251,6 +1266,7 @@ def _capture_run_started(
business_knowledge_maintained=business_knowledge_maintained,
model=model,
runtime_adapter=runtime_adapter,
+ service_tier=service_tier,
triggered_by=triggered_by,
)
try:
@@ -1359,6 +1375,7 @@ def _attach_run_shape_props(
business_knowledge_maintained: bool,
model: str | None,
runtime_adapter: str | None,
+ service_tier: str | None,
triggered_by: str,
) -> None:
"""Attach the dimensions that describe what this run was configured with, to both lifecycle
@@ -1368,7 +1385,9 @@ def _attach_run_shape_props(
which is the dimension a prompt A/B has to hold constant, and until it existed nothing recorded
which build a run used. Model and runtime adapter are attached only when the
`scouts-model-selection` gate (or a runtime pin) routed the run, so their absence means the
- agent-server default served it. `network_access` follows the same absent-means-default
+ agent-server default served it; `service_tier` likewise only when a slice or pipeline pin asked
+ for an OpenAI queue, so a flex arm and its standard control split without joining through
+ `$ai_generation`. `network_access` follows the same absent-means-default
convention (attached only for `full`), so an event-based readout never pools runs with
different egress capabilities under one model or prompt. `write_scopes` is attached only for a scout
granted extra write access, so a readout can separate runs that could change project objects from
@@ -1391,6 +1410,8 @@ def _attach_run_shape_props(
properties["model"] = model
if runtime_adapter is not None:
properties["runtime_adapter"] = runtime_adapter
+ if service_tier is not None:
+ properties["service_tier"] = service_tier
if triggered_by != TRIGGERED_BY_SCHEDULE:
properties["triggered_by"] = triggered_by
@@ -1410,6 +1431,7 @@ def _capture_run_finished(
triggered_by: str,
model: str | None = None,
runtime_adapter: str | None = None,
+ service_tier: str | None = None,
error_type: str | None = None,
error_message: str | None = None,
extra_properties: dict[str, Any] | None = None,
@@ -1449,6 +1471,7 @@ def _capture_run_finished(
business_knowledge_maintained=business_knowledge_maintained,
model=model,
runtime_adapter=runtime_adapter,
+ service_tier=service_tier,
triggered_by=triggered_by,
)
# Only attach failure context on failed runs — keeps successful / cancelled events clean
diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.py
index 2b7f4910575e..fb6ddba167ca 100644
--- a/products/signals/backend/scout_harness/serializers.py
+++ b/products/signals/backend/scout_harness/serializers.py
@@ -102,6 +102,7 @@ logger = structlog.get_logger(__name__)
"model": {"type": "string"},
"runtime_adapter": {"type": "string"},
"reasoning_effort": {"type": "string"},
+ "service_tier": {"type": "string"},
"network_access": {"type": "string"},
"write_scopes": {"type": "array", "items": {"type": "string"}},
"triggered_by": {"type": "string"},
diff --git a/products/signals/backend/test/test_agent_runtime.py b/products/signals/backend/test/test_agent_runtime.py
index 170523a07724..95aad4b2bd20 100644
--- a/products/signals/backend/test/test_agent_runtime.py
+++ b/products/signals/backend/test/test_agent_runtime.py
@@ -82,10 +82,13 @@ class TestResolveAgentRuntime:
runtime_adapter="codex", model="gpt-5.5", reasoning_effort=None, service_tier="flex"
)
- def test_non_string_service_tier_is_dropped_not_fatal(self) -> None:
+ @parameterized.expand([("non_string", True), ("unknown", "turbo"), ("typo", "flx")])
+ def test_bad_service_tier_is_dropped_not_fatal(self, _name: str, bad_tier: object) -> None:
+ # The agent server forwards the tier verbatim as the gateway's control header, which fails
+ # closed on an unknown value, so a payload typo would 400 every request of the run.
payload = {
"team_configs": {
- "2": {"steps": {"research": {"runtime_adapter": "codex", "model": "gpt-5.5", "service_tier": True}}}
+ "2": {"steps": {"research": {"runtime_adapter": "codex", "model": "gpt-5.5", "service_tier": bad_tier}}}
}
}
with patch(_READ_PATH, return_value=payload):
diff --git a/products/signals/backend/test/test_scout_harness.py b/products/signals/backend/test/test_scout_harness.py
index ff992f860afa..2f829961f268 100644
--- a/products/signals/backend/test/test_scout_harness.py
+++ b/products/signals/backend/test/test_scout_harness.py
@@ -1645,7 +1645,7 @@ def test_ai_stage_tag_only_carries_canonical_scout_names(_name, skill_name, expe
@pytest.mark.asyncio
@pytest.mark.django_db
@pytest.mark.parametrize(
- "resolved, pin, expected_model, expected_runtime_adapter, expected_reasoning_effort",
+ "resolved, pin, expected_model, expected_runtime_adapter, expected_reasoning_effort, expected_service_tier",
[
# Gate resolved, no pin: the gate's triple reaches the sandbox as-is — the runtime (and
# optional effort) travel with the model so the agent server can route it.
@@ -1655,6 +1655,7 @@ def test_ai_stage_tag_only_carries_canonical_scout_names(_name, skill_name, expe
"@cf/zai-org/glm-5.2",
"codex",
"high",
+ None,
),
# Gate resolved AND a fleet-wide pin present: the gate wins — a pin silently swallowing a
# configured model trial is the production bug this ordering exists to prevent.
@@ -1664,6 +1665,7 @@ def test_ai_stage_tag_only_carries_canonical_scout_names(_name, skill_name, expe
"@cf/zai-org/glm-5.2",
"codex",
None,
+ None,
),
# Gate unallocated remainder: falls through to the pin's whole triple (the fleet default).
(
@@ -1672,17 +1674,67 @@ def test_ai_stage_tag_only_carries_canonical_scout_names(_name, skill_name, expe
"gpt-5.5",
"codex",
"high",
+ None,
),
# Neither configured: agent-server default.
- (ScoutModel(model=None, runtime_adapter=None), AgentRuntime(), None, None, None),
+ (ScoutModel(model=None, runtime_adapter=None), AgentRuntime(), None, None, None, None),
+ # The tier travels with the model it was configured beside. A slice pinned to flex asks for
+ # flex even when the pipeline pin names the same model untiered, so a same-model flex arm can
+ # run against the remainder's standard queue. Dropping this leaves the arm on standard and the
+ # comparison measures nothing.
+ (
+ ScoutModel(model="gpt-5.6-terra", runtime_adapter="codex", reasoning_effort="medium", service_tier="flex"),
+ AgentRuntime(runtime_adapter="codex", model="gpt-5.6-terra", reasoning_effort="medium"),
+ "gpt-5.6-terra",
+ "codex",
+ "medium",
+ "flex",
+ ),
+ # The unallocated remainder runs the pin's model, so it takes the pin's tier with it.
+ (
+ ScoutModel(model=None, runtime_adapter=None),
+ AgentRuntime(runtime_adapter="codex", model="gpt-5.6-terra", service_tier="flex"),
+ "gpt-5.6-terra",
+ "codex",
+ None,
+ "flex",
+ ),
+ # A slice with no tier of its own does NOT inherit the pin's: the pin's tier was paired with
+ # the pin's model, and some models reject the field outright.
+ (
+ ScoutModel(model="gpt-5.6-luna", runtime_adapter="codex"),
+ AgentRuntime(runtime_adapter="codex", model="gpt-5.6-terra", service_tier="priority"),
+ "gpt-5.6-luna",
+ "codex",
+ None,
+ None,
+ ),
+ # A claude runtime joins no OpenAI queue: a tier on its slice (or the pin) is dropped rather
+ # than stamped, so the flex readout never counts a Claude run as a flex run.
+ (
+ ScoutModel(model="claude-sonnet-5", runtime_adapter="claude", service_tier="flex"),
+ AgentRuntime(runtime_adapter="codex", model="gpt-5.6-terra", service_tier="flex"),
+ "claude-sonnet-5",
+ "claude",
+ None,
+ None,
+ ),
],
)
async def test_run_pins_sandbox_to_resolved_scout_model(
- ateam, aerrors_skill, resolved, pin, expected_model, expected_runtime_adapter, expected_reasoning_effort
+ ateam,
+ aerrors_skill,
+ resolved,
+ pin,
+ expected_model,
+ expected_runtime_adapter,
+ expected_reasoning_effort,
+ expected_service_tier,
):
# The `scouts-model-selection` gate is the per-run experiment layer and wins when it resolves a
# model; the `signals-pipeline-models` pin is the default layer beneath it. Either way one
- # source supplies the whole runtime/model/effort triple.
+ # source supplies the whole runtime/model/effort triple. The OpenAI service tier travels with
+ # it: the selected slice's own tier, or the pin's when the pin's model runs, codex only.
# The routed model must also ride on both lifecycle events (omitted on the default path), so
# run outcomes are sliceable by model without joining through $ai_generation.
session, result = await database_sync_to_async(_make_fake_session, thread_sensitive=False)(ateam)
@@ -1719,6 +1771,7 @@ async def test_run_pins_sandbox_to_resolved_scout_model(
assert captured["context"].model == expected_model
assert captured["context"].runtime_adapter == expected_runtime_adapter
assert captured["context"].reasoning_effort == expected_reasoning_effort
+ assert captured["context"].service_tier == expected_service_tier
# The routed triple is also stamped on the bridge row's `metadata` (keys omitted when unset,
# nothing at the top level on the default path) — the native API-side record of which model
# served the run.
@@ -1729,6 +1782,7 @@ async def test_run_pins_sandbox_to_resolved_scout_model(
("model", expected_model),
("runtime_adapter", expected_runtime_adapter),
("reasoning_effort", expected_reasoning_effort),
+ ("service_tier", expected_service_tier),
)
if value is not None
}
@@ -1750,6 +1804,7 @@ async def test_run_pins_sandbox_to_resolved_scout_model(
else:
assert props["model"] == expected_model
assert props["runtime_adapter"] == expected_runtime_adapter
+ assert props.get("service_tier") == expected_service_tier
@pytest.mark.asyncio
@@ -2564,7 +2619,7 @@ def test_to_summary_and_detail_surface_task_url_from_bridge():
assert detail.task_url == summary.task_url
-_ROUTED_MODEL_KEYS = ("model", "runtime_adapter", "reasoning_effort")
+_ROUTED_MODEL_KEYS = ("model", "runtime_adapter", "reasoning_effort", "service_tier")
class TestRunRowProvenanceStamps(BaseTest):
diff --git a/products/signals/backend/test/test_scout_model_selection.py b/products/signals/backend/test/test_scout_model_selection.py
index 8e796ca7c334..c86efc4d05d4 100644
--- a/products/signals/backend/test/test_scout_model_selection.py
+++ b/products/signals/backend/test/test_scout_model_selection.py
@@ -107,30 +107,55 @@ class TestResolveScoutModel:
)
assert resolved == ScoutModel(model=GLM_MODEL, runtime_adapter="codex")
- def test_object_form_carries_reasoning_effort(self) -> None:
- # The effort pin must survive resolution — a dropped effort silently runs the trial arm at a
- # different effort than the baseline arm, skewing the comparison.
+ @parameterized.expand(
+ [
+ # Each pin must survive resolution — a dropped effort or tier silently runs the trial
+ # arm at a different setting than the baseline arm, and the comparison measures nothing.
+ ("reasoning_effort", "high"),
+ ("service_tier", "flex"),
+ ]
+ )
+ def test_object_form_carries_pin(self, key: str, value: str) -> None:
resolved = _resolve_full(
- payload=_scouts(
- {_SKILL: {GLM_MODEL: {"fraction": 1, "runtime_adapter": "codex", "reasoning_effort": "high"}}}
- )
+ payload=_scouts({_SKILL: {GLM_MODEL: {"fraction": 1, "runtime_adapter": "codex", key: value}}})
)
- assert resolved == ScoutModel(model=GLM_MODEL, runtime_adapter="codex", reasoning_effort="high")
+ assert resolved == ScoutModel(model=GLM_MODEL, runtime_adapter="codex", **{key: value})
@parameterized.expand(
[
- # A bad effort must not reach the run state — like a bad runtime, it'd fail the run
- # downstream. Drop it (effort unset) and keep the model + runtime.
- ("typo", "hgih"),
- ("non_string", 5),
- ("list", ["high"]),
+ # A bad pin must not reach the run state — like a bad runtime, it'd fail the run
+ # downstream. Drop it (unset) and keep the model + runtime.
+ ("effort_typo", "reasoning_effort", "hgih"),
+ ("effort_non_string", "reasoning_effort", 5),
+ ("effort_list", "reasoning_effort", ["high"]),
+ ("tier_unknown", "service_tier", "turbo"),
+ ("tier_non_string", "service_tier", True),
]
)
- def test_bad_reasoning_effort_is_dropped_not_fatal(self, _name: str, bad_effort: object) -> None:
- resolved = _resolve_full(
- payload=_scouts({_SKILL: {GLM_MODEL: {"fraction": 1, "reasoning_effort": bad_effort}}})
+ def test_bad_pin_is_dropped_not_fatal(self, _name: str, key: str, bad_value: object) -> None:
+ resolved = _resolve_full(payload=_scouts({_SKILL: {GLM_MODEL: {"fraction": 1, key: bad_value}}}))
+ assert resolved == ScoutModel(model=GLM_MODEL, runtime_adapter="codex")
+
+ def test_remainder_carries_no_pins_even_when_it_names_a_sliced_model(self) -> None:
+ # The flex trial's shape: a 5% slice of a model on flex, the remainder the same model on the
+ # standard queue. Recovering the spec by model id would put the whole fleet on flex and read
+ # the control arm as the treatment; the remainder must stay pin-free.
+ payload = _scouts(
+ {
+ _SKILL: {
+ GLM_MODEL: {"fraction": 0.05, "runtime_adapter": "codex", "service_tier": "flex"},
+ "default": GLM_MODEL,
+ }
+ }
)
- assert resolved == ScoutModel(model=GLM_MODEL, runtime_adapter="codex", reasoning_effort=None)
+ tiers: dict[str | None, int] = {}
+ for i in range(400):
+ resolved = _resolve_full(run_id=f"run-{i}", payload=payload)
+ assert resolved.model == GLM_MODEL
+ assert resolved.runtime_adapter == "codex"
+ tiers[resolved.service_tier] = tiers.get(resolved.service_tier, 0) + 1
+ assert set(tiers) == {"flex", None}
+ assert 5 <= tiers["flex"] <= 45 # ~5% of 400, loose enough not to flake
def test_object_form_drops_malformed_fraction(self) -> None:
# A pinned runtime can't rescue a malformed fraction — the entry is dropped, agent default kept.
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index 47fbf802b81b..ed22c847ab7c 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -3310,6 +3310,7 @@ export type SignalScoutRunSummaryApiMetadata = {
model?: string
runtime_adapter?: string
reasoning_effort?: string
+ service_tier?: string
network_access?: string
write_scopes?: string[]
triggered_by?: string
@@ -3426,6 +3427,7 @@ export type SignalScoutRunDetailApiMetadata = {
model?: string
runtime_adapter?: string
reasoning_effort?: string
+ service_tier?: string
network_access?: string
write_scopes?: string[]
triggered_by?: string
diff --git a/products/signals/skills/exploring-scouts/SKILL.md b/products/signals/skills/exploring-scouts/SKILL.md
index a91d7097dcd0..6ccc4a5a1c2c 100644
--- a/products/signals/skills/exploring-scouts/SKILL.md
+++ b/products/signals/skills/exploring-scouts/SKILL.md
@@ -35,7 +35,7 @@ The run rows also carry `emitted_count` / `emitted_finding_ids` — **legacy fie
**Never read `emitted_count: 0` as "did nothing"** — check the report columns and the run summary first.
A scout whose config carries a `structured_output_schema` has a third output channel next to reports: schema-validated **measurement records**, recorded as `$scout_structured_output` events in the project (only _scalar_ top-level payload keys flatten to `output_<key>` properties — object and array fields live solely inside the full `output` property, so a missing `output_<key>` is not a missing value; `subject` names the judged entity) rather than as run-row columns.
The events are the ground truth — `metadata.derived.has_structured_output` says the run had at least one batch **accepted**, which is a fast per-run screen but not delivery confirmation (a rare capture failure after acceptance leaves it true with fewer or no events behind it), so count the events when the number of records matters. See [`references/scout-data-model.md`](references/scout-data-model.md) for the event shape.
-Each run also carries a `metadata` map. Top-level: the provenance set `harness_prompt_version` / `report_channel` (`none`, `emit`, `edit`, or `both`) / `skill_origin` / `github_guidance`, saying which instructions the run was given; plus routing keys (`model` / `runtime_adapter` / `reasoning_effort`) only when a gate or pin overrode the default. Nested under `metadata.derived`: booleans the harness computes at the end of the run (`has_emit_report`, `has_edit_report`, `has_self_improvement`, `has_chart`, `has_self_validation`, `has_structured_output`).
+Each run also carries a `metadata` map. Top-level: the provenance set `harness_prompt_version` / `report_channel` (`none`, `emit`, `edit`, or `both`) / `skill_origin` / `github_guidance`, saying which instructions the run was given; plus routing keys (`model` / `runtime_adapter` / `reasoning_effort` / `service_tier`) only when a gate or pin overrode the default. Nested under `metadata.derived`: booleans the harness computes at the end of the run (`has_emit_report`, `has_edit_report`, `has_self_improvement`, `has_chart`, `has_self_validation`, `has_structured_output`).
When comparing runs (before/after a prompt change, one model against another), segment on all four provenance values first: runs differing on any of `harness_prompt_version`, `report_channel`, `skill_origin`, or `github_guidance` were given different instructions and aren't a like-for-like population. Runs predating this field have none of them, so treat missing provenance as unknown and exclude those runs from a comparison rather than pooling them.
For "what kind of run was this?" questions — did it author a self-improvement report, did it validate its follow-up queue — read `derived` rather than parsing the prose summary. It's computed server-side from what the run actually did, so it can't disagree with the run's own output — with one exception: `has_structured_output` tracks batches the run had **accepted**, not events delivered, so it alone can be true with fewer or no records behind it (count the events, as above). No `derived` map at all means unknown, not "all false" — the run predates the field, failed before finishing, or its stamp failed. Most runs from before this shipped have no map, so don't read their absence as a finding.
diff --git a/products/signals/skills/exploring-scouts/references/scout-data-model.md b/products/signals/skills/exploring-scouts/references/scout-data-model.md
index ec8a6ef1adeb..a845dacecf28 100644
--- a/products/signals/skills/exploring-scouts/references/scout-data-model.md
+++ b/products/signals/skills/exploring-scouts/references/scout-data-model.md
@@ -34,22 +34,22 @@ The run is a thin bridge to a `tasks.TaskRun` — status, timing, and the full t
`runs-retrieve` takes the run id as `id`, **not** `run_id` — even though the list and the detail payload both name the field `run_id`.
Pass the list's `run_id` value through as `id`.
-| Field | Meaning |
-| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `run_id` | UUID of the run. Pass it to `runs-retrieve` as `id`. Strictly team-scoped (404 across teams). |
-| `skill_name` | Which scout ran. |
-| `skill_version` | The body version that ran. If a scout was edited, older runs ran an older version — useful when comparing behavior before/after a change. |
-| `status` | Run outcome, from the linked `TaskRun` (see below). |
-| `started_at` | ISO-8601 — when the `TaskRun` was created. |
-| `completed_at` | ISO-8601 — when it finished. `null` while in flight. Duration = `completed_at - started_at`. |
-| `emitted_report_ids` | The reports the run **authored** via `emit_report`, in order. This (with `edited_report_ids`) is the run's output — resolve each id via `inbox-reports-retrieve`. Empty = the run authored nothing, except on a measurement scout, whose output is its `$scout_structured_output` records. |
-| `edited_report_ids` | The reports the run **edited** via `edit_report` (title/summary rewrite, appended note, or reviewers set), deduped. Edits can target any inbox report, not just scout-authored ones. |
-| `emitted_count` | **Legacy** — how many weak findings the run emitted on the deprecated signal channel. Always `0` on report-channel scouts; populated only on runs from scouts still on the legacy channel. Don't infer "did nothing" from `0` — check the report id columns. |
-| `emitted_finding_ids` | **Legacy** — the `finding_id`s behind `emitted_count`, in emit order. Each maps to a `Signal` with `source_id = run:<run_id>:finding:<finding_id>`. Empty on report-channel scouts. |
-| `metadata` | Two server-written regions. Top-level keys are runner-stamped at run start: `harness_prompt_version` / `report_channel` (`none`/`emit`/`edit`/`both`) / `skill_origin` / `github_guidance` (the provenance set — which prompt build, which report tools, canonical or custom skill, and whether the GitHub evidence section was rendered; segment on all four before comparing runs, and treat runs missing them as unknown rather than pooling them), plus `model` / `runtime_adapter` / `reasoning_effort` only when routing overrode the default. `metadata.derived` is the harness's own map of booleans computed at finalize (`has_emit_report`, `has_edit_report`, `has_self_improvement`, `has_chart`, `has_self_validation`, `has_structured_output`) — the structured answer to "what kind of run was this?", so read it before parsing `summary`. Nothing here is scout-declared, so it can't contradict the run's actual output — except `has_structured_output`, which counts accepted batches rather than delivered events (see the structured-output section below). No `derived` map at all means unknown — the run predates the field (most historical runs), never reached finalize, or its stamp failed — never that every flag was false. |
-| `task_id`, `task_run_id` | Identifiers on the Tasks side. |
-| `task_url` | Relative deep-link to the Tasks UI for this run — **the full transcript** (every tool call and reasoning step) lives here, not in the run payload. |
-| `summary` | The scout's own one-paragraph end-of-run close-out. The primary thing to read and relay. Empty for runs that errored before close-out. |
+| Field | Meaning |
+| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `run_id` | UUID of the run. Pass it to `runs-retrieve` as `id`. Strictly team-scoped (404 across teams). |
+| `skill_name` | Which scout ran. |
+| `skill_version` | The body version that ran. If a scout was edited, older runs ran an older version — useful when comparing behavior before/after a change. |
+| `status` | Run outcome, from the linked `TaskRun` (see below). |
+| `started_at` | ISO-8601 — when the `TaskRun` was created. |
+| `completed_at` | ISO-8601 — when it finished. `null` while in flight. Duration = `completed_at - started_at`. |
+| `emitted_report_ids` | The reports the run **authored** via `emit_report`, in order. This (with `edited_report_ids`) is the run's output — resolve each id via `inbox-reports-retrieve`. Empty = the run authored nothing, except on a measurement scout, whose output is its `$scout_structured_output` records. |
+| `edited_report_ids` | The reports the run **edited** via `edit_report` (title/summary rewrite, appended note, or reviewers set), deduped. Edits can target any inbox report, not just scout-authored ones. |
+| `emitted_count` | **Legacy** — how many weak findings the run emitted on the deprecated signal channel. Always `0` on report-channel scouts; populated only on runs from scouts still on the legacy channel. Don't infer "did nothing" from `0` — check the report id columns. |
+| `emitted_finding_ids` | **Legacy** — the `finding_id`s behind `emitted_count`, in emit order. Each maps to a `Signal` with `source_id = run:<run_id>:finding:<finding_id>`. Empty on report-channel scouts. |
+| `metadata` | Two server-written regions. Top-level keys are runner-stamped at run start: `harness_prompt_version` / `report_channel` (`none`/`emit`/`edit`/`both`) / `skill_origin` / `github_guidance` (the provenance set — which prompt build, which report tools, canonical or custom skill, and whether the GitHub evidence section was rendered; segment on all four before comparing runs, and treat runs missing them as unknown rather than pooling them), plus `model` / `runtime_adapter` / `reasoning_effort` / `service_tier` only when routing overrode the default. `metadata.derived` is the harness's own map of booleans computed at finalize (`has_emit_report`, `has_edit_report`, `has_self_improvement`, `has_chart`, `has_self_validation`, `has_structured_output`) — the structured answer to "what kind of run was this?", so read it before parsing `summary`. Nothing here is scout-declared, so it can't contradict the run's actual output — except `has_structured_output`, which counts accepted batches rather than delivered events (see the structured-output section below). No `derived` map at all means unknown — the run predates the field (most historical runs), never reached finalize, or its stamp failed — never that every flag was false. |
+| `task_id`, `task_run_id` | Identifiers on the Tasks side. |
+| `task_url` | Relative deep-link to the Tasks UI for this run — **the full transcript** (every tool call and reasoning step) lives here, not in the run payload. |
+| `summary` | The scout's own one-paragraph end-of-run close-out. The primary thing to read and relay. Empty for runs that errored before close-out. |
### Run status values
diff --git a/products/tasks/backend/facade/api.py b/products/tasks/backend/facade/api.py
index 75b0ffe2cd0e..8f5df3dfcf0b 100644
--- a/products/tasks/backend/facade/api.py
+++ b/products/tasks/backend/facade/api.py
@@ -2300,6 +2300,8 @@ _PROTECTED_RUN_STATE_KEYS = frozenset(
"provider",
"model",
"reasoning_effort",
+ # The OpenAI queue the run's Codex turns join; `priority` costs more than standard.
+ "service_tier",
"claude_model_access",
"claude_subscription_user_id",
"rtk_effective",
diff --git a/products/tasks/backend/tests/test_api.py b/products/tasks/backend/tests/test_api.py
index d36660856356..439a2a23d177 100644
--- a/products/tasks/backend/tests/test_api.py
+++ b/products/tasks/backend/tests/test_api.py
@@ -5664,6 +5664,7 @@ class TestTaskRunAPI(BaseTaskAPITest):
"provider": "anthropic",
"model": "claude-sonnet-5",
"reasoning_effort": "low",
+ "service_tier": "default",
"rtk_effective": True,
"benjamin_effective": True,
"usage_metrics_recorded": True,
@@ -5734,6 +5735,8 @@ class TestTaskRunAPI(BaseTaskAPITest):
"provider": "openai",
"model": "claude-opus-4-8",
"reasoning_effort": "high",
+ # the premium queue costs more; a writable tier is a spend escalation
+ "service_tier": "priority",
"rtk_effective": False,
"benjamin_effective": False,
"usage_metrics_recorded": False,
@@ -5789,6 +5792,7 @@ class TestTaskRunAPI(BaseTaskAPITest):
assert run.state["provider"] == "anthropic"
assert run.state["model"] == "claude-sonnet-5"
assert run.state["reasoning_effort"] == "low"
+ assert run.state["service_tier"] == "default"
assert run.state["rtk_effective"] is True
assert run.state["benjamin_effective"] is True
assert run.state["usage_metrics_recorded"] is True
@@ -5829,6 +5833,7 @@ class TestTaskRunAPI(BaseTaskAPITest):
"provider",
"model",
"reasoning_effort",
+ "service_tier",
"rtk_effective",
"benjamin_effective",
"usage_metrics_recorded",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index cffb47ad0370..d937e8c23e0c 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -80037,6 +80037,7 @@ export namespace Schemas {
model?: string;
runtime_adapter?: string;
reasoning_effort?: string;
+ service_tier?: string;
network_access?: string;
write_scopes?: string[];
triggered_by?: string;
@@ -80134,6 +80135,7 @@ export namespace Schemas {
model?: string;
runtime_adapter?: string;
reasoning_effort?: string;
+ service_tier?: string;
network_access?: string;
write_scopes?: string[];
triggered_by?: string;