@sagentlab/navarch-runtime 0.1.126 → 0.1.127
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/github-credential.cjs +43 -0
- package/dist/session.cjs +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GITHUB_CREDENTIAL_SECRET_NAME = void 0;
|
|
4
|
+
exports.githubCredentialDenialSummary = githubCredentialDenialSummary;
|
|
5
|
+
/** Wire name the session requests its repository credential under. */
|
|
6
|
+
exports.GITHUB_CREDENTIAL_SECRET_NAME = "github-pat";
|
|
7
|
+
/**
|
|
8
|
+
* Denials that mean no repository credential exists for this lease, rather
|
|
9
|
+
* than one being refused: the project has neither a GitHub App installation
|
|
10
|
+
* nor a `github-pat` secret (`not_found`), or a standalone PR review on a
|
|
11
|
+
* PAT-connected project, which deliberately gets none
|
|
12
|
+
* (`standalone_review_read_only`). The machine's own git login has always
|
|
13
|
+
* been the clone credential then, so those sessions keep running.
|
|
14
|
+
*/
|
|
15
|
+
const NO_CREDENTIAL_REASONS = new Set(["not_found", "standalone_review_read_only"]);
|
|
16
|
+
const MEMBER_FIX = "or have a project owner move this agent to the project GitHub identity, then resume the agent on the Agents page.";
|
|
17
|
+
const REASON_TEXT = {
|
|
18
|
+
member_github_missing: `this agent acts as a project member whose GitHub account is not connected. Connect GitHub on that member's Account page, ${MEMBER_FIX}`,
|
|
19
|
+
member_github_revoked: `this agent acts as a project member whose GitHub authorization was revoked. Reconnect GitHub on that member's Account page, ${MEMBER_FIX}`,
|
|
20
|
+
member_github_unavailable: `this agent acts as a project member whose GitHub credential could not be read. Reconnect GitHub on that member's Account page, ${MEMBER_FIX}`,
|
|
21
|
+
member_not_in_project: `this agent acts as a member who does not belong to this project. Add them to the project, ${MEMBER_FIX}`,
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The failure summary for a lease whose repository credential the broker
|
|
25
|
+
* refused, or null when the session may proceed.
|
|
26
|
+
*
|
|
27
|
+
* Without this check a refused credential left the clone to whatever git
|
|
28
|
+
* credential helper the host had configured — on pebble-agent-1721
|
|
29
|
+
* (2026-10-21) that was `gh auth git-credential` for an account that cannot
|
|
30
|
+
* see the repository, so every claim failed with an unexplained "Repository
|
|
31
|
+
* not found". The summary leads with `GitHub credential denied (<reason>):`,
|
|
32
|
+
* which the control plane's failure attribution anchors on to pause the
|
|
33
|
+
* machine instead of spending the task's retries
|
|
34
|
+
* (lib/navarch/failure-attribution.ts MEMBER_GITHUB_RULE).
|
|
35
|
+
*/
|
|
36
|
+
function githubCredentialDenialSummary(denied) {
|
|
37
|
+
const denial = denied?.find((entry) => entry.name === exports.GITHUB_CREDENTIAL_SECRET_NAME);
|
|
38
|
+
if (!denial || NO_CREDENTIAL_REASONS.has(denial.reason))
|
|
39
|
+
return null;
|
|
40
|
+
const explanation = REASON_TEXT[denial.reason] ?? "the control plane refused the repository credential for this lease.";
|
|
41
|
+
return (`GitHub credential denied (${denial.reason}): ${explanation} ` +
|
|
42
|
+
"The session stopped before cloning instead of falling back to this machine's own git login.");
|
|
43
|
+
}
|
package/dist/session.cjs
CHANGED
|
@@ -34,6 +34,7 @@ const completion_retry_cjs_1 = require("./completion-retry.cjs");
|
|
|
34
34
|
const adapter_capacity_cjs_1 = require("./adapter-capacity.cjs");
|
|
35
35
|
const agent_auth_cjs_1 = require("./agent-auth.cjs");
|
|
36
36
|
const agent_model_cjs_1 = require("./agent-model.cjs");
|
|
37
|
+
const github_credential_cjs_1 = require("./github-credential.cjs");
|
|
37
38
|
const browser_evidence_cjs_1 = require("./browser-evidence.cjs");
|
|
38
39
|
/** Filename the generated platform MCP config is written under inside the session metadata directory. */
|
|
39
40
|
const MCP_CONFIG_FILENAME = "mcp-config.json";
|
|
@@ -164,6 +165,24 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
|
|
|
164
165
|
secrets = issued.secrets;
|
|
165
166
|
managedGithubCredential = issued.github_app_issued === true;
|
|
166
167
|
registry.registerAll(secrets);
|
|
168
|
+
const credentialDenial = (0, github_credential_cjs_1.githubCredentialDenialSummary)(issued.denied);
|
|
169
|
+
if (credentialDenial) {
|
|
170
|
+
log.error(`session ${leaseId}: ${credentialDenial}`);
|
|
171
|
+
await api.completeLease(leaseId, {
|
|
172
|
+
status: "failed",
|
|
173
|
+
report: credentialDenial,
|
|
174
|
+
failure_summary: credentialDenial,
|
|
175
|
+
failed_before_start: true,
|
|
176
|
+
evidence_urls: [],
|
|
177
|
+
cost: { tokens_in: 0, tokens_out: 0, cost_usd: 0 },
|
|
178
|
+
exit_status: "crashed",
|
|
179
|
+
agent_type: runtime,
|
|
180
|
+
...executionReport,
|
|
181
|
+
});
|
|
182
|
+
secrets = {};
|
|
183
|
+
await node_fs_1.promises.rm(workDir, { recursive: true, force: true }).catch(() => undefined);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
167
186
|
}
|
|
168
187
|
let gitCredentialRefresh;
|
|
169
188
|
if (managedGithubCredential && secrets["github-pat"]) {
|
package/package.json
CHANGED