Skip to content

Goose CLI logs: total_tokens is always 0 #5907

@agardnerIT

Description

@agardnerIT

Describe the bug

Goose CLI session logs always have the total_tokens field set to zero 0.


To Reproduce
Steps to reproduce the behavior:

  1. Start a new session: goose session
  2. Ask goose and the LLM to create a Python file to do something
  3. Exit the session: exit

The logs show the session ending but total_tokens: 0

$ goose session
starting session | provider: github_copilot model: gpt-4.1
    session id: 20251128_5
    working directory: /workspaces/ai-sre-workflow-demo

goose is running! Enter your instructions, or try asking what goose can do.

Context: ○○○○○○○○○○ 0% (0/1000000 tokens)
( O)> create a python file in /tmp/foo.py which prints the numbers 1, 2 and 3

─── text_editor | developer ──────────────────────────
path: /tmp/foo.py
command: write
file_text: print(1)
print(2)
print(3)


# Info Received

- **Datetime**: 2025-11-28 04:01:16

---

# Action Taken

- Created a simple Python script (`/tmp/foo.py`) with example print statements for testing.

---

# Summary Table

| Component        | Details                                 |
|------------------|-----------------------------------------|
| Info Message     | Datetime: 2025-11-28 04:01:16           |
| Script Creation  | /tmp/foo.py with `print(1)\nprint(2)\nprint(3)` |

If you have further instructions or a specific task you want to work on, please let me know!

⏱️  Elapsed time: 5.04s
Context: ○○○○○○○○○○ 0% (0/1000000 tokens)
( O)> exit
Closing session. Session ID: 20251128_5

Looking at the logs:

{"timestamp":"2025-11-28T04:01:20.810082Z","level":"INFO","fields":{"message":"Session completed","counter.goose.session_completions":1,"session_type":"new","exit_type":"normal","duration_ms":23707,"total_tokens":0,"message_count":4},"target":"goose_cli::cli"}
{"timestamp":"2025-11-28T04:01:20.810236Z","level":"INFO","fields":{"message":"Session duration","counter.goose.session_duration_ms":23707,"session_type":"new"},"target":"goose_cli::cli"}

Goose Version

1.15.0

Metadata

Metadata

Assignees

Labels

help wantedGreat issue for non-Block contributorsp1Priority 1 - High (supports roadmap)

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions