pacework 1.7.8 → 1.7.10

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.
@@ -36,7 +36,7 @@ import { automationDenyRules, automationLimits } from "../lib/automation-limits.
36
36
  import { truncateSummary } from "../lib/summary-text.mjs"
37
37
  import { activityForStreamEvent, createActivityTracker, createStreamReader, helpSupportsStreamJson, parseClaudeJsonResult } from "../lib/claude-activity.mjs"
38
38
  import { RUNNER_VERSION } from "../lib/version.mjs"
39
- import { catchUpWithRemote, isPushRefused, pushKeepingRemoteCommits, remoteBranchExists, switchToBranch } from "../lib/branch-sync.mjs"
39
+ import { addBranchWorktree, catchUpWithRemote, isPushRefused, pushKeepingRemoteCommits, remoteBranchExists, switchToBranch } from "../lib/branch-sync.mjs"
40
40
  import { closeSupersededPullRequest } from "../lib/superseded-pr.mjs"
41
41
  import { agentBaseEnv, agentDeniedReads, fenceUntrusted, unsandboxedWarning } from "../lib/agent-env.mjs"
42
42
  import {
@@ -1524,13 +1524,11 @@ async function pushBranchWithToken(worktreePath, branch, githubToken, repo, onRe
1524
1524
  await pushKeepingRemoteCommits({
1525
1525
  exec: gitIn(worktreePath),
1526
1526
  fetch: () => authed(["fetch", "origin", branch]),
1527
- push: () => authed(["push", "--set-upstream", "origin", branch]),
1527
+ push: () => authed(["push", "origin", `HEAD:refs/heads/${branch}`]),
1528
1528
  branch,
1529
1529
  })
1530
1530
  }, {
1531
1531
  onRetry,
1532
- // `--set-upstream` writes the shared config: a lock held by another git
1533
- // process is worth waiting out too.
1534
1532
  isTransient: (error) => isGitLockError(error) || isTransientGitHubFailure(error instanceof Error ? error.message : String(error)),
1535
1533
  })
1536
1534
  } finally {
@@ -1981,7 +1979,7 @@ async function prepareWorktreeCheckout(run, runRepoRoot, worktreePath, branch) {
1981
1979
  const branchAlreadyExists = await branchExists(branch, runRepoRoot)
1982
1980
  if (branchAlreadyExists) {
1983
1981
  // Branch exists from a prior run — reuse it instead of -b
1984
- await execCommand("git", ["-C", runRepoRoot, "worktree", "add", worktreePath, branch], runRepoRoot)
1982
+ await addBranchWorktree(gitIn(runRepoRoot), worktreePath, branch)
1985
1983
  } else {
1986
1984
  // A branch GitHub already has (an open pull request, rework begun on
1987
1985
  // another machine) starts from GitHub's copy, not from main: starting
@@ -2046,6 +2044,15 @@ function buildPrompt(run, branch, worktreePath, options = {}) {
2046
2044
  Do not judge scope from a local \`git diff\` — the local base branch can be behind, and
2047
2045
  work already merged would look like part of this change. Use \`git diff\` only when the
2048
2046
  issue has no pull request yet.
2047
+ - For the test verdict, read completed CI for the exact pull request head from GitHub.
2048
+ If CI is pending or unavailable, say so explicitly and report local verification separately.
2049
+ - For local tests, use the repository's pinned package manager and frozen lockfile
2050
+ (for pnpm, \`corepack pnpm install --frozen-lockfile\` in the directory with the lockfile).
2051
+ If the locked install fails, report that test setup was blocked.
2052
+ - Call a local test failure pre-existing only after reproducing the same failure on
2053
+ the latest remote PR base (normally \`origin/main\`) in a separate worktree using
2054
+ the same toolchain, services, and test command. Name the test, base commit, and
2055
+ observed result. If the comparison cannot run, report the failure as unclassified.
2049
2056
  - Do not call \`review_pr\` or \`submit_issue_review\` yourself. The runner posts your review
2050
2057
  to the pull request and the issue from the lines below.
2051
2058
  - End your final response with exactly this, filling in every part:
@@ -12,6 +12,15 @@
12
12
  * throwing, so the caller decides where commands run.
13
13
  */
14
14
 
15
+ /** Use a detached checkout if someone already has the branch checked out. */
16
+ export async function addBranchWorktree(exec, path, branch) {
17
+ let result = await exec(["worktree", "add", path, branch])
18
+ if (result.code !== 0 && /already used by worktree|already checked out at/i.test(result.stderr)) {
19
+ result = await exec(["worktree", "add", "--detach", path, branch])
20
+ }
21
+ if (result.code !== 0) throw new Error(result.stderr || `Could not create a worktree for ${branch}`)
22
+ }
23
+
15
24
  /** Whether `origin/<branch>` exists in this checkout's remote-tracking refs. */
16
25
  export async function remoteBranchExists(exec, branch) {
17
26
  const result = await exec(["rev-parse", "--verify", "--quiet", `refs/remotes/origin/${branch}`])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacework",
3
- "version": "1.7.8",
3
+ "version": "1.7.10",
4
4
  "description": "pacework CLI: connect this machine as a runner for pacework AI agents",
5
5
  "type": "module",
6
6
  "bin": {