Skip to content

feat(acp,buzz-agent): thread model name through NIP-AM kind 44200 emit path#1564

Merged
wpfleger96 merged 1 commit into
mainfrom
duncan/nip-am-model-field
Jul 7, 2026
Merged

feat(acp,buzz-agent): thread model name through NIP-AM kind 44200 emit path#1564
wpfleger96 merged 1 commit into
mainfrom
duncan/nip-am-model-field

Conversation

@wpfleger96

Copy link
Copy Markdown
Collaborator

Summary

AgentTurnMetricPayload.model was always null because buzz-agent's usage_update notification never included a model key, and pool.rs hardcoded model: None. This PR wires the effective model name through the full 4-hop chain.

Changes

crates/buzz-agent/src/lib.rs — add "model": effective_model_str to the usage_update notification JSON. effective_model_str is already resolved in scope (session override → config default).

crates/buzz-acp/src/usage.rs — two struct additions:

  • UsageUpdatePayload: add pub model: Option<String> with #[serde(default)] so goose payloads that predate this field parse cleanly as None (fail-soft / backward compat).
  • TurnUsage: add pub model: Option<String>; record() now threads payload.model into the pending TurnUsage unconditionally — model is turn metadata, not a delta, so it must NOT be gated on delta_reliable.

crates/buzz-acp/src/pool.rs — replace model: None in publish_agent_turn_metric with model: usage.model.clone().

Tests

Two new tests in usage::tests:

  • model_threads_from_payload_to_turn_usage — asserts the model string flows record() → pending → take().
  • model_none_when_payload_omits_model_field — asserts goose-parity deserialization: payload without model parses cleanly and produces TurnUsage { model: None }.

All existing tests updated for the new struct field (model: None in the 4 TurnUsage literals and 2 UsageUpdatePayload helpers in the test suite).

Scope

Strictly limited to the model field thread. Does not touch cost/pricing (accumulated_cost, cumulative_cost_usd, turn_cost_usd, total_tokens) — that is PR #2, pending the goose-team conversation on goose-provider-types dependency.

…t path

buzz-agent's usage_update notification omitted the effective model id,
causing AgentTurnMetricPayload.model to always be null.

Wire the model name through the 4-hop chain:
- buzz-agent/src/lib.rs: include "model" key in the usage_update JSON,
  populated from effective_model_str (already in scope).
- buzz-acp/src/usage.rs UsageUpdatePayload: add model: Option<String>
  with #[serde(default)] so goose payloads without the field parse cleanly.
- buzz-acp/src/usage.rs TurnUsage: add model: Option<String>; record()
  now threads payload.model into the pending TurnUsage regardless of
  delta_reliable (model is turn metadata, not a delta).
- buzz-acp/src/pool.rs publish_agent_turn_metric: replace hardcoded
  model: None with model: usage.model.clone().

Adds two unit tests:
- model_threads_from_payload_to_turn_usage: asserts the field flows
  record() -> pending -> take().
- model_none_when_payload_omits_model_field: asserts goose-parity /
  fail-soft deserialization when the field is absent from the wire payload.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96 wpfleger96 merged commit 08e707e into main Jul 7, 2026
29 checks passed
@wpfleger96 wpfleger96 deleted the duncan/nip-am-model-field branch July 7, 2026 01:12
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