perf(AI 失敗診斷): 除錯輸出先截長度上限再遮罩降低掃描成本
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
8349fe8b71
commit
f341dc6e07
+5
-2
@@ -67,9 +67,12 @@ function agentFailureDetail(res) {
|
||||
// 僅在明確開啟 Actions step debug 時,附上「已遮罩+去控制字元」的片段作為診斷。
|
||||
const verbose = String(process.env.ACTIONS_STEP_DEBUG || '').trim().toLowerCase() === 'true';
|
||||
if (verbose) {
|
||||
const stderr = redactSecrets((res && res.stderr) || '');
|
||||
// 先截去過長輸入再遮罩,避免對數 MB 的失敗輸出跑整份 O(k×n) 正規掃描;
|
||||
// 2000 字上限已足以涵蓋跨界機密樣式,最終仍截為 500 字。
|
||||
const DEBUG_INPUT_LIMIT = 2_000;
|
||||
const stderr = redactSecrets(String((res && res.stderr) || '').slice(0, DEBUG_INPUT_LIMIT));
|
||||
if (stderr) parts.push(`stderr:${stderr.slice(0, 500)}`);
|
||||
const stdout = redactSecrets((res && res.output) || '');
|
||||
const stdout = redactSecrets(String((res && res.output) || '').slice(0, DEBUG_INPUT_LIMIT));
|
||||
if (stdout) parts.push(`stdout:${stdout.slice(0, 500)}`);
|
||||
}
|
||||
if (parts.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user