( stateDir: string, threadId: string, patch: ThreadMetaPatch, )
| 204 | /** Update display metadata for a thread, keyed by full thread ID (callers |
| 205 | * coming off a server response hold the thread ID, not the short ID). */ |
| 206 | export function updateThreadMeta( |
| 207 | stateDir: string, |
| 208 | threadId: string, |
| 209 | patch: ThreadMetaPatch, |
| 210 | ): void { |
| 211 | mutateThreadIndex(stateDir, (index) => { |
| 212 | for (const entry of Object.values(index)) { |
| 213 | if (entry.threadId === threadId) { |
| 214 | if (patch.model !== undefined) entry.model = patch.model; |
| 215 | if (patch.cwd !== undefined) entry.cwd = patch.cwd; |
| 216 | if (patch.preview !== undefined) entry.preview = patch.preview; |
| 217 | entry.updatedAt = new Date().toISOString(); |
| 218 | return; |
| 219 | } |
| 220 | } |
| 221 | console.error(`[codex] Warning: cannot update metadata for unknown thread ${threadId.slice(0, 12)}...`); |
| 222 | return false; |
| 223 | }); |
| 224 | } |
| 225 | |
| 226 | /** Update the denormalized display status for a thread, keyed by full thread |
| 227 | * ID. The run ledger is the authoritative per-invocation record; this keeps |
no test coverage detected