Skip to content

Every agent call names the model that ran it - #146

Merged
czpython merged 1 commit into
mainfrom
agent-call-names-its-model
Jul 28, 2026
Merged

Every agent call names the model that ran it#146
czpython merged 1 commit into
mainfrom
agent-call-names-its-model

Conversation

@czpython

Copy link
Copy Markdown
Owner

The sibling of #144. AgentCall.model was nullable on stated grounds:

# Nullable — a call may be recorded before its model is resolved.
model: Mapped[str | None] = mapped_column(String, default=None)

It can't be. _run resolves model = self.get_model_name() — typed -> str
and the next line picks the harness from it, which would raise on an empty one.
AgentCall.start(model=model) is fifty lines further on, past provisioning. So
the row is only ever written once the model is known, and Agent.model is a
required field with no default.

  • model: Mapped[str], and AgentCall.start(model: str)
  • migration c71b3d95e802, no backfill for the same reason agent had none:
    a guessed model would land in the cost breakdown
  • seed_call and seed_note_agent_run take model: str

Two tests pinned the case that can't happen

test_usage_today_counts_calls_whose_model_isnt_a_current_harness seeded both
"claude-opus-4-5" and None. Its own comment states the real requirement —
model ids churn on deploys, so a call finished earlier today can carry an id no
harness claims any more — and that half stays, along with the unattributed
bucket it lands in. The None half went.

test_agent_call_artifact_layout seeded model=None to show "the layout holds
with the model unresolved". The layout's actual rule is that it is the same
whichever harness ran the call, which is what it now says.

The usage panel keeps its unattributed bucket either way: a pinned or churned
id that no picker list claims is a real case, and money spent must not vanish
from the display.

The column was nullable on the grounds that a call may be recorded before
its model is resolved. It can't: the model is resolved fifty lines earlier
than the row is written, and the harness is chosen from it — an empty one
never gets that far.

Two tests pinned the unresolved case. The usage panel's real requirement is
in its own comment — model ids churn on deploys, so a call can carry an id
no harness claims any more — and that half stays; the layout test's point
is that the layout is the same whichever harness ran the call.
@czpython
czpython force-pushed the agent-call-names-its-model branch from 3eb4f39 to 7196a52 Compare July 28, 2026 17:53
@czpython
czpython enabled auto-merge (squash) July 28, 2026 17:53
@czpython
czpython merged commit ebe6d10 into main Jul 28, 2026
1 check passed
@czpython
czpython deleted the agent-call-names-its-model branch July 28, 2026 17:55
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