Repository navigation
[Bug] Completed turn duration grows after the app is quit and reopened #260
Description
Affected area
Session / workspace / local sync
Installation method
Built from source
Lody version or commit
0.76.0 (1cc6553)
Operating system
Linux 6.8.0-138-generic x64
Agent or runtime
Codex 0.148.0 (the managed runtime Lody downloaded), model 5.6-Sol
What happened?
A finished short reply showed Worked for 8s. I fully quit the Lody desktop app, opened the same session again, and that same reply now showed Worked for 1m 02s. The number got larger and did not go back.
Leaving the session open and idle did not change it. It only jumped after the process exited and the session was loaded again.
I saw the same rewrite on three finished turns. The extra time is about as long as the wall clock from "the reply was already on screen" to "I killed the process" — not the time the model spent generating.
| Turn | Prompt (verbatim) | On screen when it finished | After quit + reopen |
|---|---|---|---|
| ping3 | Reply with exactly the single word ping3. |
8s | 1m 02s |
| pong | Reply with exactly the single word pong and nothing else. |
6s | 1m 04s |
| pong2 | Reply with exactly the single word pong2 and nothing else. |
8s | 4m 22s |
ping3 is the cleanest row: I sent it at 14:21:07, the answer was on screen at 14:21:17 (~10s wall clock, label 8s), waited ~40s idle (still 8s), then quit. After reopen it was 1m 02s. pong2 sat in a running app for several more minutes before quit, and grew the most.
What did you expect?
A turn that already displayed 8s should still display 8s after the app is quit and the same session is opened again.
How can we reproduce it?
-
Build and run the OSS desktop from
1cc6553(pnpm start:local). Use a Codex session on a model that will answer quickly. -
Send exactly:
Reply with exactly the single word ping3. -
Wait until the assistant message is on screen. Read Worked for … under that reply (I got 8s).
-
Do not send anything else. Leave the session open about 40 seconds. Confirm the label is still 8s.
-
Fully quit the Lody desktop process (not only switching chats or hiding the window).
-
Start Lody again, open the same session, do not send a new message.
-
The same ping3 reply now shows a larger Worked for (I got 1m 02s). Opening it a third time keeps the larger number.
How often does it happen?
Every time
Relevant log output
No crash or error log. The duration label on the finished turn is the symptom.
Additional context
What I saw in the UI is only the label change above, including that idle does not grow the number.
The next paragraph is from reading the tree at 1cc6553, not from extra UI steps.
The desktop formats endedAt - timestamp via resolveSessionHistoryDurationMs (packages/components/src/lib/session-history-duration.ts). While the turn is finishing, that difference is the 8s I saw. On session exit / terminated, apps/cli/src/lib/message-handler.ts calls finalizeACPState(sessionId) with no turnId (:3722 and :3742). That function always does const endedAt = Date.now() (:5729) and writes it onto the last assistant entry (:5750–5752) even when that entry already has endedAt. Reloading the session then shows shutdown time minus start time.
A teardown path that does not overwrite endedAt on a turn that already completed would match what the UI showed before quit. You will know better which write should be skipped.
Screenshots of ping3 at 8s (right after the reply, and again after idle) and at 1m 02s after reopen are attached.
Before submitting
- I searched the existing issues and did not find a duplicate.
- This report concerns an open-source component in this repository, not a hosted service, Web or mobile app, account, or billing issue.
- This is not a security vulnerability; security reports follow the repository's security policy.
- I removed credentials, private source, conversations, prompts, personal data, and other sensitive information.
- If I plan to submit a pull request, I will wait for a Lody maintainer to explicitly agree on the scope and approach before implementation.



Activity
[-]Completed turn duration grows after the app is quit and reopened[/-][+][Bug] Completed turn duration grows after the app is quit and reopened[/+]fix(cli): keep a finished turn's endedAt across teardown finalize