Skip to content

bug(agents): subagent cost uses 2 decimals instead of the shared formatCost (header shows 3 below $1) #1434

Description

@vexny

Before submitting

  • I searched open and closed issues and did not find a report of this problem.
  • I reviewed this report and removed credentials, tokens, private paths, hostnames, and other sensitive data.

Problem

The Agents widget card and the Agents view task header render subagent cost with exactly two decimals ($${task.cost.toFixed(2)}), while the shell bar / fullscreen header formats cost through the shared formatCost() helper, which shows three decimals below $1 (e.g. $0.090) and two at or above $1 (e.g. $12.50). A subagent that cost $0.09 shows $0.09 in the Agents UI while the same magnitude renders $0.090 in the header: the two surfaces drift on how they paint the same fact, and small costs lose precision.

Steps to reproduce

  1. Start gentle-shell.
  2. Run a subagent (subagent_run) that accumulates a cost below $1 (e.g. $0.09).
  3. Observe the Agents card above the editor and the Agents view (alt+a) task header.
  4. Compare with the shell bar / fullscreen header cost segment.

Expected and actual behavior

Expected:
Subagent cost uses the same formatCost() as the header: three decimals below $1, two at or above $1 ($0.090, $12.50).

Actual:
Subagent cost is hardcoded to two decimals ($0.09, $12.50), diverging from the header.

gentle-pi version

3.7.0 (npm gentle-pi)

Pi version

0.87.1

Operating system

Linux

Relevant logs or error output (optional)

Source: lib/agents-widget.ts (metaFields) and lib/agents-view.ts (taskHeader) hardcode $${task.cost.toFixed(2)}, while lib/shell-bar.ts exports the shared formatCost(total, subscription) already used by the header.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions