@sagentlab/navarch-runtime 0.1.66 → 0.1.67
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/delivery.cjs +8 -4
- package/dist/git-worktree.cjs +13 -1
- package/dist/session.cjs +3 -1
- package/package.json +1 -1
package/dist/delivery.cjs
CHANGED
|
@@ -110,6 +110,13 @@ function evaluateDelivery(probe) {
|
|
|
110
110
|
}
|
|
111
111
|
return { status: "no_changes" };
|
|
112
112
|
}
|
|
113
|
+
// A failed GitHub lookup also means we cannot distinguish a genuinely
|
|
114
|
+
// unpushed commit from a successful push whose remote-tracking ref was not
|
|
115
|
+
// fetched after the agent turn. Do not fail and delete a delivered worktree
|
|
116
|
+
// based only on the cache in that state.
|
|
117
|
+
if (probe.pullRequestLookupFailed) {
|
|
118
|
+
return { status: "unknown", reason: "the pull request lookup could not run, so delivery cannot be confirmed" };
|
|
119
|
+
}
|
|
113
120
|
if (probe.unpushedCommits > 0) {
|
|
114
121
|
const plural = probe.unpushedCommits === 1 ? "commit" : "commits";
|
|
115
122
|
return {
|
|
@@ -118,10 +125,7 @@ function evaluateDelivery(probe) {
|
|
|
118
125
|
"were never pushed, so the work exists only in this session's worktree",
|
|
119
126
|
};
|
|
120
127
|
}
|
|
121
|
-
// Pushed, but nothing carries it.
|
|
122
|
-
if (probe.pullRequestLookupFailed) {
|
|
123
|
-
return { status: "unknown", reason: "the pull request lookup could not run, so delivery cannot be confirmed" };
|
|
124
|
-
}
|
|
128
|
+
// Pushed, but nothing carries it. GitHub answered the lookup above.
|
|
125
129
|
const plural = probe.commitsAhead === 1 ? "commit" : "commits";
|
|
126
130
|
return {
|
|
127
131
|
status: "incomplete",
|
package/dist/git-worktree.cjs
CHANGED
|
@@ -31,6 +31,7 @@ class GitWorktree {
|
|
|
31
31
|
cloneUrl;
|
|
32
32
|
githubToken;
|
|
33
33
|
repoLocalGithubToken;
|
|
34
|
+
prContinuation;
|
|
34
35
|
taskBranchSuffix;
|
|
35
36
|
legacyTaskBranchSuffix;
|
|
36
37
|
taskOwnershipTrailer;
|
|
@@ -57,11 +58,16 @@ class GitWorktree {
|
|
|
57
58
|
this.legacyTaskBranchSuffix = `-${normalizedTaskId}`;
|
|
58
59
|
this.taskOwnershipTrailer = `Navarch-Task-ID: ${normalizedTaskId}`;
|
|
59
60
|
this.sessionTokenMarker = `navarch-session-github-token:${sessionKey}`;
|
|
60
|
-
|
|
61
|
+
// A continuation delivers on the reviewed PR's existing branch. Its
|
|
62
|
+
// initial worktree branch is disposable and must not collide with a
|
|
63
|
+
// previous attempt's temporary branch in the bare cache.
|
|
64
|
+
this.branch = `navarch/${branchSlug(options)}${this.taskBranchSuffix}` +
|
|
65
|
+
(options.prContinuation ? `-${sessionKey}` : "");
|
|
61
66
|
this.runner = options.runner ?? sandbox_cjs_1.nodeCommandRunner;
|
|
62
67
|
this.cloneUrl = options.cloneUrl;
|
|
63
68
|
this.githubToken = options.githubToken;
|
|
64
69
|
this.repoLocalGithubToken = options.repoLocalGithubToken;
|
|
70
|
+
this.prContinuation = options.prContinuation ?? false;
|
|
65
71
|
this.hostedCheckpointRef = options.restoreHostedCheckpoint ? hostedCheckpointRef(options.taskId) : null;
|
|
66
72
|
this.hostedCheckpointLocalRef = `refs/navarch/restored-checkpoints/${taskKey}`;
|
|
67
73
|
}
|
|
@@ -349,6 +355,12 @@ class GitWorktree {
|
|
|
349
355
|
}
|
|
350
356
|
/** Returns the fetched task-owned remote branch when an earlier attempt pushed it. */
|
|
351
357
|
async resolveTaskBranchRef() {
|
|
358
|
+
// A follow-up must check out the reviewed PR's head, not adopt a branch
|
|
359
|
+
// bearing this task's short suffix. An earlier attempt may have pushed its
|
|
360
|
+
// temporary branch after dropping the claim commit; that branch must not
|
|
361
|
+
// prevent later attempts from reaching the actual PR.
|
|
362
|
+
if (this.prContinuation)
|
|
363
|
+
return null;
|
|
352
364
|
const refs = await this.runGit(["--git-dir", this.repositoryPath, "for-each-ref", "--format=%(refname)", "refs/remotes/origin/navarch"], false);
|
|
353
365
|
const suffixMatches = refs.stdout
|
|
354
366
|
.split("\n")
|
package/dist/session.cjs
CHANGED
|
@@ -199,6 +199,7 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
|
|
|
199
199
|
taskId: task.id,
|
|
200
200
|
taskSummary: task.summary,
|
|
201
201
|
taskType: task.task_type,
|
|
202
|
+
prContinuation: allowBranchRename,
|
|
202
203
|
sessionId,
|
|
203
204
|
cloneUrl,
|
|
204
205
|
githubToken,
|
|
@@ -622,7 +623,8 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
|
|
|
622
623
|
deliveryFailureSummary =
|
|
623
624
|
`Session ended without delivering the task: ${delivery.reason}. ` +
|
|
624
625
|
`${deliveryCorrectionRetries} correction turn(s) did not recover it. ` +
|
|
625
|
-
"The session worktree is deleted at teardown
|
|
626
|
+
"The session worktree is deleted at teardown. Pushed commits remain on origin; " +
|
|
627
|
+
"uncommitted or unpushed work may be lost. The task needs another attempt.";
|
|
626
628
|
log.warn(`failing ${leaseId}: ${deliveryFailureSummary}`);
|
|
627
629
|
mapping.leaseOutcome = "failed";
|
|
628
630
|
mapping.exitStatus = "failed";
|
package/package.json
CHANGED