microsoft / microsoft/amplifier

bug(streaming-ui): per-call cost on every token line appears pages above user prompt; same value shows twice on simple turns (appears doubled)

Open
#291 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.1k
Forks
261
Avg merge
3h 28m
Merged PRs (30d)
13

Description

Repo: amplifier-module-hooks-streaming-ui
File: amplifier_module_hooks_streaming_ui/__init__.pyhandle_content_block_end()

Evidence

Real session with sub-agent delegation:

└ Input: 11,506 (caching...) | Output: 218 | Total: 11,724 | Cost: $0.02    ← first LLM call (mid-turn)
  [tool calls, sub-agent output...]
└ Input: 12,530 (64% cached) | Output: 145 | Total: 12,675 | Cost: $0.00711955
💰 Turn: $0.38 | Session: $2.00    ← right above user prompt

In a turn with multiple LLM calls (tool use, sub-agents), cost appears on every individual call's token line, scattered throughout the output. The first cost line is many screens above the next > prompt. For simple single-call turns the same value appears twice — per-call line AND 💰 Turn line — which looks like cost doubling to users.

Intended behavior

The design intent was "cost above the user input, not above the assistant response." Cost should only appear on the 💰 Turn: $X | Session: $Y line from orchestrator:complete, which fires once per user turn immediately before the > prompt.

Fix (already applied on feat/m0-cost-management)

Remove the cost_usd/cost_part block from handle_content_block_end. Per-call token lines become tokens-only:

└ Input: 11,506 (caching...) | Output: 218 | Total: 11,724

All cost consolidated at orchestrator:complete (right above user prompt):

💰 Turn: $0.38 | Session: $2.00

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in amplifier_module_hooks_streaming_ui/init.py at handle_content_block_end() and compare the current behavior with the fix described on feat/m0-cost-management. Verify that per-call token lines contain no cost and that the 💰 Turn line from orchestrator:complete is the only cost display immediately before the user prompt.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.