@kylecheng3146/agent-ops 0.1.17 → 0.1.18
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.
|
@@ -103,6 +103,17 @@ function firstComplaint(...streams) {
|
|
|
103
103
|
}
|
|
104
104
|
return undefined;
|
|
105
105
|
}
|
|
106
|
+
function rejectedCallReason(output) {
|
|
107
|
+
if (/\b(?:quota|rate limit|usage limit|too many requests)\b/iu.test(output)) {
|
|
108
|
+
return "quota-exhausted";
|
|
109
|
+
}
|
|
110
|
+
if (/\b(?:not logged in|login required|log in to|authentication required|unauthenticated|unauthorized)\b/iu.test(output) ||
|
|
111
|
+
/\b(?:invalid|expired)\s+(?:api key|token|credential)/iu.test(output) ||
|
|
112
|
+
/\b401\b/u.test(output)) {
|
|
113
|
+
return "login-required";
|
|
114
|
+
}
|
|
115
|
+
return "capability-unavailable";
|
|
116
|
+
}
|
|
106
117
|
async function snapshotRepository(request, destination, options) {
|
|
107
118
|
const cloned = await runVerificationCommand({
|
|
108
119
|
id: `review-snapshot-${request.label}`,
|
|
@@ -256,11 +267,8 @@ async function attemptTarget(request, options) {
|
|
|
256
267
|
return skip("output-too-large", `${spawned.stdoutTruncated ? "stdout" : "stderr"} exceeded the capture limit`);
|
|
257
268
|
}
|
|
258
269
|
if (spawned.failureClass === "nonzero-exit") {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
// the reader to `doctor --check-auth` for a problem it cannot see. The
|
|
262
|
-
// target's own first line of complaint distinguishes the two.
|
|
263
|
-
return skip("login-required", firstComplaint(spawned.stderr, spawned.stdout) ??
|
|
270
|
+
const output = `${spawned.stderr}\n${spawned.stdout}`;
|
|
271
|
+
return skip(rejectedCallReason(output), firstComplaint(spawned.stderr, spawned.stdout) ??
|
|
264
272
|
`the call was rejected with exit ${spawned.exitCode ?? "unknown"} and no output`);
|
|
265
273
|
}
|
|
266
274
|
const payload = extractReviewObject(target, spawned.stdout);
|
|
@@ -40,7 +40,10 @@ export function renderReviewResult(result) {
|
|
|
40
40
|
for (const error of result.validationErrors ?? []) {
|
|
41
41
|
lines.push(`- ${safe(error.path)}: ${safe(error.code)} — ${safe(error.message)}`);
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
if (result.reason === "login-required" ||
|
|
44
|
+
result.attempts?.some((attempt) => attempt.reason === "login-required")) {
|
|
45
|
+
lines.push("Run: agent-ops doctor --check-auth to verify target authentication.");
|
|
46
|
+
}
|
|
44
47
|
return `${lines.join("\n")}\n`;
|
|
45
48
|
}
|
|
46
49
|
const report = result.report;
|
|
@@ -94,8 +94,11 @@ human-readable report is transient. Completed tasks are never rewritten.
|
|
|
94
94
|
`--yes` is still required for every review run: init selection decides which
|
|
95
95
|
targets are permitted, `--yes` decides whether to spend money now.
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
Reviewer failures are classified conservatively from their output: recognizable
|
|
98
|
+
authentication messages become `login-required`, quota messages become
|
|
99
|
+
`quota-exhausted`, and other non-zero exits become `capability-unavailable`.
|
|
100
|
+
The review suggests `doctor --check-auth` only when an authentication failure
|
|
101
|
+
was detected. Confirm target authentication with:
|
|
99
102
|
|
|
100
103
|
```bash
|
|
101
104
|
agent-ops doctor # presence only: no tokens, no network
|
|
@@ -82,8 +82,10 @@ policy 設定仍相同的 task;`--criterion` 用來篩選 id。請先執行
|
|
|
82
82
|
每次執行 review 仍需 `--yes`:init 的勾選決定「允許哪些目標」,
|
|
83
83
|
`--yes` 決定「現在是否要花錢」。
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
Reviewer 失敗會依輸出採保守分類:可辨識的認證訊息為 `login-required`,
|
|
86
|
+
quota 訊息為 `quota-exhausted`,其他非零退出則為 `capability-unavailable`。
|
|
87
|
+
只有偵測到認證失敗時,review 才會建議執行 `doctor --check-auth`。
|
|
88
|
+
可用以下指令確認目標的認證狀態:
|
|
87
89
|
|
|
88
90
|
```bash
|
|
89
91
|
agent-ops doctor # 只驗執行檔存在:零 token、零網路
|