@codemoot/cli 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1830,11 +1830,26 @@ ${fixOutputContract}`,
1830
1830
  const timeoutMs = options.timeout * 1e3;
1831
1831
  const progress = createProgressCallbacks("fix-review");
1832
1832
  console.error(chalk9.dim(" GPT reviewing..."));
1833
- const reviewResult = await adapter.callWithResume(reviewPrompt, {
1834
- sessionId: threadId,
1835
- timeout: timeoutMs,
1836
- ...progress
1837
- });
1833
+ let reviewResult;
1834
+ try {
1835
+ reviewResult = await adapter.callWithResume(reviewPrompt, {
1836
+ sessionId: threadId,
1837
+ timeout: timeoutMs,
1838
+ ...progress
1839
+ });
1840
+ } catch (err) {
1841
+ if (threadId) {
1842
+ console.error(chalk9.yellow(" Clearing stale codex thread ID after failure."));
1843
+ sessionMgr.updateThreadId(session2.id, null);
1844
+ threadId = void 0;
1845
+ }
1846
+ throw err;
1847
+ }
1848
+ const resumed = threadId && reviewResult.sessionId === threadId;
1849
+ if (threadId && !resumed) {
1850
+ threadId = void 0;
1851
+ sessionMgr.updateThreadId(session2.id, null);
1852
+ }
1838
1853
  if (reviewResult.sessionId) {
1839
1854
  threadId = reviewResult.sessionId;
1840
1855
  sessionMgr.updateThreadId(session2.id, reviewResult.sessionId);
@@ -3350,11 +3365,22 @@ ${fileContents}`,
3350
3365
  }
3351
3366
  const timeoutMs = (options.timeout ?? 600) * 1e3;
3352
3367
  const progress = createProgressCallbacks("review");
3353
- const result = await adapter.callWithResume(prompt, {
3354
- sessionId: sessionThreadId,
3355
- timeout: timeoutMs,
3356
- ...progress
3357
- });
3368
+ let result;
3369
+ try {
3370
+ result = await adapter.callWithResume(prompt, {
3371
+ sessionId: sessionThreadId,
3372
+ timeout: timeoutMs,
3373
+ ...progress
3374
+ });
3375
+ } catch (err) {
3376
+ if (sessionThreadId) {
3377
+ sessionMgr.updateThreadId(session2.id, null);
3378
+ }
3379
+ throw err;
3380
+ }
3381
+ if (sessionThreadId && result.sessionId !== sessionThreadId) {
3382
+ sessionMgr.updateThreadId(session2.id, null);
3383
+ }
3358
3384
  if (result.sessionId) {
3359
3385
  sessionMgr.updateThreadId(session2.id, result.sessionId);
3360
3386
  }