Profile "Longest task" does not update for completed long-running /goal tasks

Open 💬 4 comments Opened Jun 7, 2026 by yourprism
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Bug

Codex Profile "Longest task" is not updating for completed long-running slash goals.

This appears related to goal/profile persistence, but the key detail is that this is not only old experimental-goal history: an 8h+ /goal was run after the Profile / "Longest task" feature was already visible in the Codex app, completed successfully, and still did not update the profile stat.

Environment

  • Codex CLI: codex-cli 0.130.0
  • Platform: macOS
  • Local ~/.codex/version.json latest_version: 0.130.0

Details

  • Current Profile "Longest task" remains stuck at 3h 48m.
  • I ran an 8h+ Codex task after the Profile / "Longest task" feature was already visible in the app.
  • That task was an actual slash goal (/goal) and completed successfully.
  • The profile stat still did not update.
  • I originally remembered an older long task as roughly 41h, but local evidence shows the PRISM /goal session actually spanned about 53.63h and did not save/show in profile stats.

Local Evidence

Local Codex CLI session history exists for a task longer than my original ~41h estimate:

  • ~/.codex/sessions/2026/05/04/rollout-2026-05-04T17-27-21-019df51a-6664-7600-b1bb-c46a6f9f54c3.jsonl
  • Timestamp span: about 53.63h
  • Appears to be a PRISM /goal task

But:

  • ~/.codex/goals_1.sqlite exists
  • thread_goals currently has 0 rows
  • goals_1.sqlite migration:
  • 1 | thread goals | 2026-05-22 18:16:08 | success=1
  • state_5.sqlite goal migrations:
  • 29 | thread goals | 2026-05-01 00:36:17 | success=1
  • 33 | thread goal stopped statuses | 2026-05-22 18:16:08 | success=1
  • 34 | drop thread goals | 2026-05-22 18:16:08 | success=1

So the raw session history exists, but the structured goal/profile tracker did not persist the long-running goal records.

Related Issue

Possibly related to #25407, but this report is specifically about Profile "Longest task" not updating for a post-Profile, real completed /goal, plus local evidence that the goal DB has no persisted rows.

Expected

The Profile "Longest task" stat should update to the longest completed /goal task.

Actual

The stat remains stuck at 3h 48m despite completed 8h+ and much longer goal sessions.

Evidence Available

I can provide screenshots of:

  • Profile showing "Longest task" stuck at 3h 48m
  • Completed 8h+ /goal
  • Longer CLI/session evidence

I am not pasting raw JSONL contents publicly because session logs may contain sensitive material, but I can provide them privately through a secure support channel if needed.

View original on GitHub ↗

4 Comments

github-actions[bot] contributor · 2 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #25881

Powered by Codex Action

yourprism · 2 months ago

Adding context after checking the related goal-storage issues (#23984, #25407, and the duplicate suggestion #25881):

The existing recovery advice/workarounds I found are:

  • fully restart Codex / any stale codex app-server processes so the app-server version matches the CLI version;
  • make sure the goals feature flag is not explicitly disabled;
  • for persistent thread/goal/get failures that may be SQLite corruption, rebuild local Codex state DBs (goals_1.sqlite* / state_5.sqlite*) after backup/restart.

This issue is meant to track a distinct downstream symptom: the Profile Longest task stat did not update for a completed 8h+ /goal that happened after the Profile stat existed, and local raw session history shows much longer goal-like sessions while the structured goals_1.sqlite.thread_goals table is empty (count(*) = 0).

So even if restart/DB rebuild fixes future /goal operation, there still appears to be a profile-stat persistence/backfill gap: completed long-running goal history exists in session JSONL, but the structured goal/profile tracker did not retain it for Longest task.

etraut-openai contributor · 2 months ago

Yes, the "longest task" displayed in the profile should more accurately be labeled "longest turn". A /goal is composed of many turns, so it doesn't appear in this accounting. We're considering adding separate accounting for goals.

Necmttn · 2 months ago

The profile metric needs separate concepts for turn, goal run, and session.

For /goal, store goal_run_id, started_at, completed_at, terminal status, turn ids included, model legs, and interruptions. The profile can then show longest turn and longest completed goal separately, instead of making an 8h goal disappear because it was split across many turns.

---

_Generated with ax._