10 Commits
Author SHA1 Message Date
jiantw83 273c4f7e4b Merge pull request '修正 Codex Action 重複輸出最後回答' (#4) from develop into master
CD / 發布專案 (push) Successful in 3s
CD / 計算版本號 (push) Successful in 1s
Reviewed-on: actions/codex#4
2026-06-24 14:30:53 +00:00
jiantw83 9018aeccbb Merge pull request '修正 Codex Action 重複輸出最後回答' (#3) from ai-review-resolve/20260624102518 into develop
CI / 計算版本號 (pull_request) Successful in 2s
CI / 工具測試 (pull_request) Successful in 9s
Reviewed-on: actions/codex#3
2026-06-24 14:30:13 +00:00
AI Review Bot 9f7a2e97c3 chore: update ai-review findings [ai-review-bot][success]
AI / Code Review (pull_request) Successful in 2s
CI / 計算版本號 (pull_request) Successful in 3s
CI / 工具測試 (pull_request) Successful in 9s
2026-06-24 14:23:08 +00:00
jiantw83 ab56c56206 fix(app): 停止串流 Codex transcript
CI / 計算版本號 (pull_request) Successful in 2s
CI / 工具測試 (pull_request) Successful in 9s
AI / Code Review (pull_request) Successful in 23s
2026-06-24 14:22:38 +00:00
AI Review Botandjiantw83 49061fe033 chore: update ai-review findings [ai-review-bot][success]
CI / 工具測試 (pull_request) Successful in 10s
CI / 計算版本號 (pull_request) Successful in 2s
AI / Code Review (pull_request) Successful in 2s
2026-06-24 14:17:48 +00:00
jiantw83 ffdb53c645 test(entrypoint): 覆蓋 Codex transcript 重複輸出 2026-06-24 14:16:47 +00:00
jiantw83 cab7507ddb fix(app): 僅輸出 Codex 最後回覆 2026-06-24 14:16:47 +00:00
admin 8a09aaf22c Merge pull request '處理 AI review findings 並改寫 Node.js entrypoint' (#2) from develop into master
CD / 計算版本號 (push) Successful in 1s
CD / 發布專案 (push) Successful in 5s
Reviewed-on: actions/codex#2
2026-06-24 14:13:10 +00:00
jiantw83 0b26fbeeb7 Merge pull request '處理 AI review findings 並改寫 Node.js entrypoint' (#1) from ai-review-resolve/20260624102518 into develop
CI / 計算版本號 (pull_request) Successful in 3s
CI / 工具測試 (pull_request) Successful in 14s
Reviewed-on: actions/codex#1
2026-06-24 14:09:26 +00:00
AI Review Bot 30130b715b chore: update ai-review findings [ai-review-bot][success]
AI / Code Review (pull_request) Successful in 1s
CI / 計算版本號 (pull_request) Successful in 2s
CI / 工具測試 (pull_request) Successful in 12s
2026-06-24 14:06:46 +00:00
4 changed files with 17 additions and 25 deletions
+6
View File
@@ -148,5 +148,11 @@
"role": "Maya", "role": "Maya",
"original_finding": "對於 codex 執行失敗的各種細節(權限不足、找不到 binary 等)都統一處理為 status: 1,測試未驗證具體錯誤來源。", "original_finding": "對於 codex 執行失敗的各種細節(權限不足、找不到 binary 等)都統一處理為 status: 1,測試未驗證具體錯誤來源。",
"reason": "此 GitHub Action 對外輸出以 `status=completed|failed` 與 `output` 訊息表達成功或失敗;process exit code 只需反映 Codex 子程序結果或通用啟動失敗。細分 ENOENT、EACCES 等 Action exit code 會改變既有介面且對 workflow 判斷價值有限,本次已用簡潔 output 訊息與測試覆蓋具體錯誤來源。" "reason": "此 GitHub Action 對外輸出以 `status=completed|failed` 與 `output` 訊息表達成功或失敗;process exit code 只需反映 Codex 子程序結果或通用啟動失敗。細分 ENOENT、EACCES 等 Action exit code 會改變既有介面且對 workflow 判斷價值有限,本次已用簡潔 output 訊息與測試覆蓋具體錯誤來源。"
},
{
"location": "app/main.js:142",
"role": "Rogue",
"original_finding": "移除這些無謂的重新編碼比較,直接嘗試解碼。",
"reason": "AI 對話收斂判定為誤報(問題在最新程式碼中不成立或不適用)"
} }
] ]
+6 -15
View File
@@ -2,24 +2,15 @@
{ {
"level": "warning", "level": "warning",
"role": "Bard", "role": "Bard",
"location": "app/main.js:245", "location": "app/main.js:241",
"problem": "`runCodex` 函式中,對 `lastMessageFile` 的讀取缺乏明確的錯誤處理策略,直接將錯誤靜默處理並初始化為空字串,可能掩蓋真正的檔案系統問題,且導致邏輯錯誤。", "problem": "`runCodex` 中 `resultOutput` 的計算邏輯過於緊湊且不易維護,且直接進行檔案同步讀取,若檔案過大可能阻塞 Node.js 事件循環。",
"suggestion": "建議在 `catch` 區塊中至少加入簡單的日誌記錄(如 `console.error`),並明確區分錯誤類型(如檔案不存在 vs 權限問題),給予清晰的回饋。" "suggestion": "建議拆解複雜的邏輯為獨立的輔助函數,並改用非同步的檔案讀取方式。"
},
{
"level": "info",
"role": "Rogue",
"location": "app/main.js:200",
"problem": "每次執行 runCodex 都在建立新的 temp 目錄與追蹤檔案,這種重複性的檔案系統配置開銷對於高頻率呼叫來說是完全浪費的資源。",
"suggestion": "如果執行環境是持續存在的,應快取 tempDir 路徑或使用預設的共享路徑,避免頻繁的檔案系統建立與追蹤開銷。",
"is_new": true
}, },
{ {
"level": "info", "level": "info",
"role": "Bard", "role": "Bard",
"location": "app/main.js:248", "location": "app/main.js:321",
"problem": "在 `resolve` 函式的回傳值邏輯中使用了 `lastMessage || output.toString()`,這種基於真值判斷(truthiness)的邏輯若 `lastMessage` 為空字串但 `output` 亦為空,會導致語意不明,且與前面處理錯誤的情境交織,增加閱讀複雜度。", "problem": "確保字串結尾換行的樣板程式碼邏輯重複出現。",
"suggestion": "建議明確區分 `lastMessage` 的來源,若確定檔案應存在,請使用更明確的判斷方式(如檢查檔案是否存在或長度),提升程式碼的可預測性。", "suggestion": "建立 `ensureNewline` 共用工具函式。"
"is_new": true
} }
] ]
+4 -9
View File
@@ -215,8 +215,6 @@ function runCodex(model, prompt) {
output.append(Buffer.from(`Codex execution timed out after ${timeoutMs} ms.\n`)); output.append(Buffer.from(`Codex execution timed out after ${timeoutMs} ms.\n`));
}, timeoutMs); }, timeoutMs);
child.stderr.pipe(process.stdout);
child.stdout.on("data", (chunk) => { child.stdout.on("data", (chunk) => {
output.append(chunk); output.append(chunk);
}); });
@@ -239,14 +237,11 @@ function runCodex(model, prompt) {
output.append(Buffer.from(`Codex process terminated by signal ${signal}.\n`)); output.append(Buffer.from(`Codex process terminated by signal ${signal}.\n`));
} }
let lastMessage = ""; const lastMessage = fs.existsSync(lastMessageFile) ? fs.readFileSync(lastMessageFile, "utf8") : null;
try { const diagnosticOutput = output.toString();
lastMessage = fs.readFileSync(lastMessageFile, "utf8"); const resultOutput = code === 0 && lastMessage !== null ? lastMessage : diagnosticOutput || lastMessage || "";
} catch {
lastMessage = "";
}
resolve({ status: code ?? 1, output: lastMessage || output.toString() }); resolve({ status: code ?? 1, output: resultOutput });
}); });
}); });
} }
+1 -1
View File
@@ -70,7 +70,7 @@ while [ "$#" -gt 0 ]; do
shift shift
done done
printf '%s\n' 'codex' 'final answer' 'tokens used' '123' 'final answer' printf '%s\n' 'codex' 'final answer' 'tokens used' '123' 'final answer' >&2
printf '%s\n' 'final answer' > "$last_message_file" printf '%s\n' 'final answer' > "$last_message_file"
SH SH
chmod +x "$dir/codex" chmod +x "$dir/codex"