Skip to content

fix(backtests): a timed-out run leaves no record, so My Agents says "No backtests yet" #524

Description

@FlyM1ss

Reported symptom: an hour-long DeepSeek V4 Pro backtest ended and the agent's My Agents card reads "No backtests yet."

That copy is false, and it is the only thing left on the surface the user opened. A killed child never reaches the saving phase, so no agent_runs row is written — verified in prod: 0 rows for agent_20260922_202119_fc7bd724, and 0 rows for that agent's session. renderAgentCardBody falls through to the empty state whenever run_count / latest_run are absent (app.js:1452), which is also the state of an agent that has never run. The two are indistinguishable.

The explanation does exist — but only in _recent_slots, a process-local dict capped at 50 (api/routers/backtests.py:990-996), keyed by live_run_id, surfaced on the Backtest tab. GET /backtest/status still answers correctly today:

{"running":false,"timed_out":true,"elapsed_seconds":3605,
 "message":"Backtest stopped at the time limit.",
 "timeout":{"limit_seconds":3600,"billing_mode":"platform_credits",
            "spent_micro":81130,"model_calls":38}}

It dies on the next redeploy, and reaching it requires holding the run id on the right tab. The browser polled once after the kill (21:22:21 UTC) and stopped.

So a run that spent an hour and 81,130 micro-credits is, on the page the user actually goes to, identical to never having happened.

  • Persist a terminal outcome for a run that produced no results — a failed/timed-out agent_runs row, or a small run-outcome record — so the card can say what happened.
  • At minimum, make the empty state distinguish "never ran" from "no results to show".

#500 gave the timeout an outcome and copy. This is about that outcome surviving the tab it was shown on.

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