Skip to content

[Bug]: DeepSeek-V4-Flash-0731 consumed ~22M tokens in prolonged agent loop and failed to complete an Excel engineering task #47253

Closed as not planned

Description

@mymcp2002

Description

Description

I used OpenCode Desktop 1.18.25 with DeepSeek-V4-Flash-0731 for a bounded engineering task: creating and validating a production-oriented ICU Antibiotic Stewardship Excel workbook.

The task required generating an XLSX workbook with multiple relational sheets, formulas, validation rules, conditional formatting, dashboards/worklists, demo data, and automated validation/testing.

The model initially generated a substantial workbook and performed multiple iterations of testing and debugging. However, the session became extremely long and consumed 21,955,093 tokens according to the token provider's usage dashboard.

Despite extensive iterative debugging, the requested final workbook was not successfully delivered.

Environment

  • OpenCode Desktop: 1.18.25
  • OS: Windows 11
  • Model: DeepSeek-V4-Flash-0731
  • Project: workbook-icu-excel

Observed behavior

The model repeatedly entered long generate → test → diagnose → modify → retest cycles.

During debugging, the following was established:

  1. The generated XLSX was a valid ZIP/OOXML package and could be read by openpyxl.

  2. Excel COM validation initially failed to open the workbook.

  3. A bisect process isolated one failure to Data Validation in the Antibiotic Therapy sheet.

  4. The model replaced cross-sheet Data Validation references with workbook-level Named Ranges.

  5. The targeted Data Validation test then passed.

  6. Full workbook validation still failed.

  7. A further bisect showed that the first 10 data sheets opened successfully in Excel COM.

  8. The remaining failure was narrowed to one of:

    • Alerts-Flags
    • Dashboard
    • Worklist
    • Instructions
  9. The session was stopped before the remaining failure was isolated and the final workbook was delivered.

Impact

The task was bounded and had a clearly defined deliverable, but the agent consumed:

21,955,093 tokens (~21.96M)

without reaching a completed final artifact.

This is particularly concerning because the model demonstrated meaningful debugging progress, including successfully isolating and fixing one Excel compatibility problem, but continued execution did not converge to a completed result.

Related OpenCode reports

This appears potentially related to existing DeepSeek-V4-Flash issues involving repetition, looping, or excessive token consumption:

The current report differs in that the failure occurred during a substantial multi-step engineering task involving tool calls, file generation, Excel validation, and iterative debugging.

Evidence

OpenCode shared session:

https://opncd.ai/share/aHlGUPVV

The complete OpenCode session was also exported as JSON.

Token usage:

21,955,093 tokens

according to the token provider's usage dashboard.

Expected behavior

For a bounded engineering task, the agent should either:

  1. complete the requested artifact and validate it successfully, or
  2. detect that progress is no longer converging and stop with a clear failure state.

It should not consume tens of millions of tokens through prolonged iterative execution without completing the task.

Request

Please investigate whether this behavior is related to the known DeepSeek-V4-Flash repetition/looping issues in OpenCode, particularly when the model is performing long-running tool-assisted engineering tasks.

I would also like to know whether OpenCode has any safeguards for detecting non-convergent agent behavior, excessive repeated tool execution, or unusually high token consumption.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Sep 4, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of, or closely related to, existing open issues. Please check:

    These share the same core symptom: no convergence detection or circuit breaker to halt runaway agent execution before excessive token consumption occurs.

  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

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