@sagentlab/navarch-runtime 0.1.59 → 0.1.60
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/git-worktree.cjs +25 -0
- package/dist/session.cjs +5 -1
- package/package.json +1 -1
package/dist/git-worktree.cjs
CHANGED
|
@@ -387,6 +387,14 @@ class GitWorktree {
|
|
|
387
387
|
.split("\n")
|
|
388
388
|
.some((line) => line.trim() === this.taskOwnershipTrailer);
|
|
389
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* The ownership line a push to the delivery branch must keep, for the
|
|
392
|
+
* pre-push guard (`NAVARCH_DELIVERY_TASK_MARKER`). Null for a resumed legacy
|
|
393
|
+
* full-UUID branch, whose name alone proves ownership.
|
|
394
|
+
*/
|
|
395
|
+
get deliveryTaskMarker() {
|
|
396
|
+
return this.branch.endsWith(this.legacyTaskBranchSuffix) ? null : this.taskOwnershipTrailer;
|
|
397
|
+
}
|
|
390
398
|
/** Records full task ownership without lengthening the human-facing branch name. */
|
|
391
399
|
async createTaskOwnershipCommit() {
|
|
392
400
|
await this.runGit([
|
|
@@ -657,6 +665,11 @@ async function pathExists(value) {
|
|
|
657
665
|
* the allocated `navarch/...` branch (for example onto Codex's default
|
|
658
666
|
* `codex/...` prefix). `--no-verify` bypasses any hook, so
|
|
659
667
|
* `resolveDeliveryHead` also repairs the worktree before completion.
|
|
668
|
+
*
|
|
669
|
+
* With `NAVARCH_DELIVERY_TASK_MARKER` it also refuses a delivery-branch push
|
|
670
|
+
* whose history lost the task's ownership commit (an amend, reset, or rebase
|
|
671
|
+
* drops the empty claim commit). A retry only resumes a short-suffix branch
|
|
672
|
+
* that carries the marker, so an unmarked push strands the task.
|
|
660
673
|
*/
|
|
661
674
|
const DELIVERY_BRANCH_GUARD_HOOK = `#!/bin/sh
|
|
662
675
|
# Managed by @sagentlab/navarch-runtime (git-worktree.cts).
|
|
@@ -672,6 +685,18 @@ while read -r local_ref local_sha remote_ref remote_sha; do
|
|
|
672
685
|
if [ "$branch" != "$allowed" ]; then
|
|
673
686
|
printf '%s\\n' "navarch: refusing to push '$branch'; this task's delivery branch is '$allowed'." >&2
|
|
674
687
|
status=1
|
|
688
|
+
continue
|
|
689
|
+
fi
|
|
690
|
+
marker="\${NAVARCH_DELIVERY_TASK_MARKER:-}"
|
|
691
|
+
[ -n "$marker" ] || continue
|
|
692
|
+
case "$local_sha" in
|
|
693
|
+
*[!0]*) ;;
|
|
694
|
+
*) continue ;;
|
|
695
|
+
esac
|
|
696
|
+
if [ -z "$(git log -1 --format=%H --fixed-strings --grep="$marker" "$local_sha" 2>/dev/null)" ]; then
|
|
697
|
+
printf '%s\\n' "navarch: refusing to push '$branch'; its history no longer contains the task ownership line '$marker' (the empty 'chore(navarch): claim task branch' commit was amended, reset, or rebased away)." >&2
|
|
698
|
+
printf '%s\\n' "navarch: restore it with: git commit --allow-empty -m 'chore(navarch): claim task branch' -m '$marker' && git push" >&2
|
|
699
|
+
status=1
|
|
675
700
|
fi
|
|
676
701
|
done
|
|
677
702
|
exit "$status"
|
package/dist/session.cjs
CHANGED
|
@@ -420,8 +420,12 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
|
|
|
420
420
|
await node_fs_1.promises.writeFile(node_path_1.default.join(workDir, "prompt.md"), promptText, "utf8");
|
|
421
421
|
}
|
|
422
422
|
// Preparation may resume an existing task branch with an older slug or ID format.
|
|
423
|
-
if (!allowBranchRename)
|
|
423
|
+
if (!allowBranchRename) {
|
|
424
424
|
sessionEnv.NAVARCH_DELIVERY_BRANCH = gitWorktree.branch;
|
|
425
|
+
const marker = gitWorktree.deliveryTaskMarker;
|
|
426
|
+
if (marker)
|
|
427
|
+
sessionEnv.NAVARCH_DELIVERY_TASK_MARKER = marker;
|
|
428
|
+
}
|
|
425
429
|
if (sandbox) {
|
|
426
430
|
await sandbox.create();
|
|
427
431
|
// Security-policy refusals (a mount outside the allowlist, an egress
|
package/package.json
CHANGED