MCPcopy Create free account
hub / github.com/Kevin7Qi/codex-collab / updateThreadMeta

Function updateThreadMeta

src/threads.ts:206–224  ·  view source on GitHub ↗
(
  stateDir: string,
  threadId: string,
  patch: ThreadMetaPatch,
)

Source from the content-addressed store, hash-verified

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). */
206export 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

Callers 2

threads.test.tsFile · 0.90
startOrResumeThreadFunction · 0.90

Calls 1

mutateThreadIndexFunction · 0.85

Tested by

no test coverage detected