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

Function updateThreadStatus

src/threads.ts:229–245  ·  view source on GitHub ↗
(
  stateDir: string,
  threadId: string,
  status: NonNullable<ThreadIndexEntry["lastStatus"]>,
)

Source from the content-addressed store, hash-verified

227 * ID. The run ledger is the authoritative per-invocation record; this keeps
228 * `threads` listings current without a ledger scan. */
229export function updateThreadStatus(
230 stateDir: string,
231 threadId: string,
232 status: NonNullable<ThreadIndexEntry["lastStatus"]>,
233): void {
234 mutateThreadIndex(stateDir, (index) => {
235 for (const entry of Object.values(index)) {
236 if (entry.threadId === threadId) {
237 entry.lastStatus = status;
238 entry.updatedAt = new Date().toISOString();
239 return;
240 }
241 }
242 console.error(`[codex] Warning: cannot update status for unknown thread ${threadId.slice(0, 12)}...`);
243 return false;
244 });
245}
246
247export function removeThread(stateDir: string, shortId: string): void {
248 const filePath = threadsFilePath(stateDir);

Callers 7

turns.test.tsFile · 0.90
handleShutdownSignalFunction · 0.90
recordTerminalRunStateFunction · 0.90
recordRunFailureFunction · 0.90
handleKillFunction · 0.90
handleRunFunction · 0.90
handleReviewFunction · 0.90

Calls 1

mutateThreadIndexFunction · 0.85

Tested by

no test coverage detected