Browse Source

fix: address Greptile review feedback — variant placement, dead code, log message

1. cancel-task: remove dead abortStartedAt variable
2. cancel-task: fix misleading 'after unstable abort' log message
3. secondary-model: add throwOnError to session.create for proper error surfacing
4. secondary-model: extract variant from model object, pass as top-level param
   to session.prompt (matches v2 SDK type — variant is sibling to model, not nested)
Michael Henke 5 days ago
parent
commit
dc740092b0
2 changed files with 11 additions and 7 deletions
  1. 1 2
      src/tools/cancel-task.ts
  2. 10 5
      src/tools/smartfetch/secondary-model.ts

+ 1 - 2
src/tools/cancel-task.ts

@@ -222,7 +222,6 @@ async function abortAndVerifySession(
   taskID: string,
 ): Promise<void> {
   log('[cancel-task] abort attempt starting', { taskID });
-  const abortStartedAt = Date.now();
   try {
     // ponytail: abortSessionWithTimeout now takes v2 OpencodeClient
     await abortSessionWithTimeout(
@@ -251,7 +250,7 @@ async function deleteAndVerifySession(
 ): Promise<void> {
   const v2 = getClient(options.input);
 
-  log('[cancel-task] deleting session after unstable abort', {
+  log('[cancel-task] deleting session after abort attempt', {
     taskID,
     reason,
   });

+ 10 - 5
src/tools/smartfetch/secondary-model.ts

@@ -230,10 +230,13 @@ async function runSecondaryModel(
   const v2 = getClient(input);
   const directory = input.directory;
 
-  const sessionResponse = await v2.session.create({
-    directory,
-    title: 'smartfetch-secondary',
-  });
+  const sessionResponse = await v2.session.create(
+    {
+      directory,
+      title: 'smartfetch-secondary',
+    },
+    { throwOnError: true },
+  );
 
   const session = sessionResponse.data;
   const sessionId = session?.id;
@@ -261,11 +264,13 @@ async function runSecondaryModel(
       (toolIDs || []).map((id: string) => [id, false]),
     );
 
+    const { variant, ...modelOnly } = model;
     const result = await Promise.race([
       v2.session.prompt({
         sessionID: sessionId,
         directory,
-        model,
+        model: modelOnly,
+        ...(variant ? { variant } : {}),
         system:
           'Answer only from the supplied content. Do not use tools or outside knowledge.',
         tools: disabledTools,