@sagentlab/navarch-runtime 0.1.27 → 0.1.29

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.
@@ -41,9 +41,11 @@ function matchingPullRequestUrl(body, repository, matchesHead) {
41
41
  const candidate = matches.find((pullRequest) => pullRequest.state === "open") ?? matches[0];
42
42
  return typeof candidate?.html_url === "string" ? candidate.html_url : null;
43
43
  }
44
- async function fetchPullRequests(url, headers, fetchImpl) {
44
+ async function fetchPullRequests(url, headers, fetchImpl, options = {}) {
45
45
  const response = await fetchImpl(url, { headers });
46
46
  if (!response.ok) {
47
+ if (options.emptyStatuses?.includes(response.status))
48
+ return [];
47
49
  throw new Error(`GitHub pull request lookup failed with HTTP ${response.status}`);
48
50
  }
49
51
  return response.json();
@@ -87,7 +89,11 @@ async function findHeadBranchPullRequestUrl(options) {
87
89
  return branchMatch;
88
90
  const commitUrl = new URL(`https://api.github.com/repos/${encodeURIComponent(owner)}/${encodeURIComponent(name)}/commits/${normalizedHeadSha}/pulls`);
89
91
  commitUrl.searchParams.set("per_page", "10");
90
- return matchingPullRequestUrl(await fetchPullRequests(commitUrl, headers, fetchImpl), normalizedRepository, (candidate) => typeof candidate.head?.sha === "string" &&
92
+ return matchingPullRequestUrl(
93
+ // GitHub answers 422 ("No commit found for SHA") when the local head was
94
+ // never pushed -- the normal case for sessions that end without a PR, so
95
+ // it means "no evidence", not a lookup failure.
96
+ await fetchPullRequests(commitUrl, headers, fetchImpl, { emptyStatuses: [404, 422] }), normalizedRepository, (candidate) => typeof candidate.head?.sha === "string" &&
91
97
  candidate.head.sha.toLowerCase() === normalizedHeadSha);
92
98
  }
93
99
  function isPullRequestUrlForRepository(value, repository) {
package/dist/session.cjs CHANGED
@@ -625,6 +625,10 @@ const REMEDIABLE_REJECTION_CODES = new Set([
625
625
  // the file usually already exists in the worktree, so the remediation turn
626
626
  // only has to call register_artifact and PUT the upload.
627
627
  "artifact_required",
628
+ // A registered render whose duration misses the brief's target_duration:
629
+ // the source assets are still in the worktree, so a remediation turn can
630
+ // re-cut to length, re-register the artifact, and retry on the same lease.
631
+ "duration_mismatch",
628
632
  "pr_not_ready",
629
633
  "review_attestation_required",
630
634
  "review_attestation_invalid",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sagentlab/navarch-runtime",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "Navarch machine-side session manager: claims delivery tasks and runs them through Claude Code, Codex, Gemini, or OpenCode.",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",