Repository navigation
[2736 by Claude Opus 5.5] ## Salvage agent work before destroying the worktree, and diagnose push rejections - #2755
Conversation
…oPR now saves the agent's commits before deleting the worktree, and it tells you why the push was rejected and how to get the work back. Lint and typecheck pass, 31 affected server suites pass, and the new CLI, UI and Playwright tests pass. I haven't run the full repository test suite. The salvage ladder. This runs in issue implementation runs, PR follow-ups (which covers `/fix` and ultrafix cycles) and merge-conflict jobs. It runs before the job's existing cleanup and lock release, and the success path is unchanged. When the push fails, ProPR tries these in order: 1. Retry once with a refreshed installation token. 2. Push the same commits to `refs/propr/rescue/<taskId>` on the same repository. 3. Write a git bundle to `<DATA_DIR>/rescue/<owner>/<repo>/<taskId>.bundle`. The directory can be changed with `PUSH_RESCUE_BUNDLE_DIR`. 4. Keep the worktree with a `.retention-info.json` marker, whatever `WORKTREE_RETENTION_STRATEGY` says. Its HEAD is detached so the next job on the same PR can still check out the branch. The rung that succeeded is recorded on the task timeline. The task then fails with a message that leads with the rejection class, the unblock URL and the exact recovery command. Rejection diagnosis. Git's push output is classified as `push_protection`, `ruleset_or_branch_protection`, `non_fast_forward`, `auth`, `network` or `unknown`. The diagnosis is stored in the failed history entry's metadata rather than a new database column. It shows up in three places: - Task detail timeline: a red panel with the class, the unblock URL as a link, and the recovery command. - `propr task get`: a "Push Rejection" section, and `pushFailure` in `--json`. - GitHub failure comment: the unblock URL appears verbatim. I raised the comment's length limit for these errors so the URL is never cut off. Rescue-ref cleanup. The daemon deletes rescue refs and bundles older than `PUSH_RESCUE_RETENTION_DAYS` (default 14) at startup and every 6 hours; `0` turns this off. It runs alongside the existing draft-context sweep rather than as a new `propr` command. Rescue refs are ignored by merge-conflict detection on push events and refused as task branches. Behaviour changes to be aware of: - An issue run whose push fails now ends failed. Before, it could end completed with no PR. - When the push failed, ProPR no longer tries to create the PR again through the API afterwards. - If the push failed for a reason ProPR can't classify, the failure message includes git's raw output after the summary. Tests added: classifier tests on realistic git output for each class. Ladder tests covering each rung: rescue-ref and bundle recovery run against real local git remotes, the other cases use fakes. Tests that rescue refs are ignored and pruned correctly, plus the CLI, UI component and a Playwright page test. I also updated five existing tests whose mocks of `@propr/core` list every export, and pointed one test's bundle directory at a temp folder. Docs: `maintenance.md`, `troubleshooting.md`, `git-management.md`, `configuration-reference.md` and a CHANGELOG entry under Unreleased. The new logic is mainly in `packages/core/src/git/pushSalvage.ts` and `pushRejection.ts`. I captured desktop and mobile screenshots of the new timeline panel as preview evidence.
|
/ultrafix goal=8 max=5 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 5) First action:
|
|
CI failed: CodeQL Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit 12697e4 Processed 5 comments:
Summary of ChangesI fixed all five CodeQL alerts. The three affected suites pass (23/23), including two new regression tests, and lint passes. Typecheck shows no errors in the changed files; one unrelated error remains because ReDoS fixes:
Test-only alerts (
The workspace had no 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ass (23/23), including two new regression tests, and lint passes. Typecheck shows no errors in the changed files; one unrelated error remains because `@propr/local-setup` isn't built in this workspace. I fixed all five CodeQL alerts. The three affected suites pass (23/23), including two new regression tests, and lint passes. Typecheck shows no errors in the changed files; one unrelated error remains because `@propr/local-setup` isn't built in this workspace. **ReDoS fixes:** - **`extractUnblockUrls`** (`packages/core/src/git/pushRejection.ts`, comments 1 and 5): the single regex over the whole push output is gone. The function now splits the output on the same characters that ended a URL before. For each piece it takes the text from the first `http://` or `https://`, keeps it only if it contains `/secret-scanning/unblock-secret/` followed by more characters, and strips trailing `.,;:` with a simple loop. Results are the same as before, including removing duplicates and the trailing-punctuation behaviour. - **`sanitizeRescueId`** (`packages/core/src/git/rescueRefs.ts`, comment 2): leading and trailing `.` and `-` are now trimmed with index loops instead of `/^[.-]+|[.-]+$/g`. The other steps are unchanged. - **Regression tests:** one feeds 50,000 repeats of `http://` and 50,000 commas into `extractUnblockUrls` and requires it to finish in under a second. The other checks that `sanitizeRescueId` trims long runs of separators and still falls back to `task`. **Test-only alerts** (`test/pushSalvage.test.ts`): - **Comment 3:** the two substring checks are now exact checks. The error message must contain a line that is exactly `Unblock URL: <url>`, and `extractUnblockUrls` run on the markdown must return exactly `[UNBLOCK_URL]`. This is stricter than before. - **Comment 4:** the bundle restore test now runs `git fetch -- <bundlePath> HEAD`, so the path can't be read as a git option such as `--upload-pack`. The workspace had no `node_modules`, so I ran `npm ci --ignore-scripts` and built `packages/shared` before testing. PR: #2755 Comment by: @github-advanced-security[bot] (ID: 4190134983) Comment by: @github-advanced-security[bot] (ID: 4190135017) Comment by: @github-advanced-security[bot] (ID: 4190135031) Comment by: @github-advanced-security[bot] (ID: 4190135036) Comment by: @github-advanced-security[bot] (ID: 4190135003) Model: claude-opus-5-5
|
ℹ️ Analyzed the follow-up request by @propr-dev[bot] Analysis SummaryI made no code changes because these three alerts are already fixed on this branch. CI ran CodeQL against
The patterns that remain (splitting on separators, single character classes, I couldn't run the repo's test suites because this workspace has no
The functions also still give the same results as before. An unblock URL with a trailing The alerts should close when CodeQL runs on the current head. If the check still fails there, it's from something new, and I'd need that run's output to fix it. No code changes were necessary based on the current state of the branch. 🤖 Analysis Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a coherent salvage ladder and exposes recovery details across task history, GitHub comments, the UI, and CLI. It needs changes before merge because some failure paths still bypass preservation, and retention can contradict the documented configuration. ✅ Structured recovery reporting — Salvage outcomes and terminal push failures carry recovery locations and instructions through the job handlers and presentation layers. ✅ Useful integration coverage — Tests exercise real Git rescue refs and bundle restoration, alongside classifier and UI coverage. The authoritative checks show 41 passed, none failed or pending, and 9 neutral/skipped. This review is a static analysis of the supplied code; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Include credential acquisition in salvage handling
F2: 🔴 Honor disabled retention for worktrees
F3: 🔴 Preserve diagnosis when credential refresh fails
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Exercise pruning outside a checkoutThe pruning integration test runs with the test process’s working directory, while S2: 🟢 Quote recovery command arguments
ScoreThe implementation has strong breadth and passing checks, but the uncovered preservation path and incorrect retention and diagnosis behavior require correction. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 35a5e84
Summary of ChangesI fixed F1, F2 and F3, and added a regression test for each. All six related test files pass ( F1 – getting the token now goes through salvage (
F2 –
F3 – the original rejection survives a failed token refresh (
Setup: this container had no dependencies installed, so I ran the repo's own Not fixed (outside the selected findings): in No previews were made because nothing visible changed. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…. All six related test files pass (`pushSalvage`, the new `issueJobPushSalvage`, `prPublicationJob`, `prPublicationRecoveryJob`, `rescueRefHygiene`, `issueJobCompletion`), and lint and the core typecheck are clean. I also ran the F1 test against the old version of `issueJobPush.ts`, and it fails there as it should.
I fixed F1, F2 and F3, and added a regression test for each. All six related test files pass (`pushSalvage`, the new `issueJobPushSalvage`, `prPublicationJob`, `prPublicationRecoveryJob`, `rescueRefHygiene`, `issueJobCompletion`), and lint and the core typecheck are clean. I also ran the F1 test against the old version of `issueJobPush.ts`, and it fails there as it should.
**F1 – getting the token now goes through salvage** (`src/jobs/issueJobPush.ts`)
- The first `octokit.auth({ type: 'installation' })` call now happens inside the `try`. If getting a token fails, the same salvage steps run as for a rejected push: retry, rescue ref, bundle, then keep the worktree.
- I checked the other push path in `prPublication.ts`. Its token request already happens inside the guarded `pushOnce`, so it needed no change.
- New test `test/issueJobPushSalvage.test.ts`: every token request fails, and the agent's commits still end up in a verified bundle, reported as an `auth` failure.
**F2 – `PUSH_RESCUE_RETENTION_DAYS=0` now keeps worktrees indefinitely** (`packages/core/src/git/pushSalvage.ts`, `worktreeOperations.ts`)
- With a retention of 0, the `.retention-info.json` marker now stores `retentionHours: null` and `scheduledCleanup: null`. The old code silently turned 0 into 24 hours.
- A new check, `isActiveSalvageRetention`, treats a salvage marker with no deadline as permanent. Both places that clean up worktrees use it: the per-job cleanup (`cleanupWorktree`) and the periodic sweep (`cleanupExpiredWorktrees`).
- That second change was required: the sweep runs `new Date(null)`, which gives a 1970 date, so without the check it would have deleted the worktree straight away.
- New tests: with retention 0, the worktree survives both cleanups. A salvaged worktree with a finite retention that has passed is still deleted.
**F3 – the original rejection survives a failed token refresh** (`pushSalvage.ts`)
- If refreshing the token fails during the retry, that error is now wrapped in a new `CredentialRefreshError`. The salvage code then keeps the original push error as the reason for the failure.
- The refresh failure is still recorded in the retry attempt, as `Credential refresh failed: …`.
- If the retry push itself is rejected, that rejection is still diagnosed as before.
- New test: the original push is blocked by secret scanning and the refresh then fails with an auth error. The final reason stays `push_protection`, the unblock URL is kept, and the commits are saved to a bundle.
**Setup:** this container had no dependencies installed, so I ran the repo's own `npm ci` and `npm run test:prepare` to run the tests. No setup files changed.
**Not fixed (outside the selected findings):** in `prPublication.ts`, the retry goes through `pushOnce`. Before pushing, that runs `checkpoint` and asks for a token without forcing a refresh. If either of those fails with an error that looks like an auth or network problem, it could still replace the original diagnosis.
No previews were made because nothing visible changed.
PR: #2755
Comment by: @propr-ultrafix (ID: 0)
Model: claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a cohesive salvage ladder and carries push diagnostics through task history, GitHub comments, the UI, and CLI. It needs a localized security correction before merge. Current checks report 41 passed, none failed or pending, and nine skipped. ✅ Cleanup protection — Active salvage retention markers override normal worktree deletion, including indefinite retention. ✅ Structured diagnostics — Rejection classification, unblock URLs, and recovery locations reach existing history consumers without a schema change. ✅ Recovery coverage — Tests cover each salvage rung and real Git bundle restoration. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F4: 🔴 Quote generated recovery commands
SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Track rescue creation timeThe ref sweeper measures retention from the commit’s committer date, whereas bundles and retained worktrees use salvage-time timestamps. Consider recording rescue creation time so historical commits receive the same recovery window. This is an optional retention-policy improvement: the current documentation explicitly describes commit-age pruning. ScoreThe implementation has broad integration and useful recovery tests, with all current checks passing. Unsafe recovery-command generation remains a merge blocker requiring a focused fix. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 8472ac9
Summary of ChangesI fixed F4: the generated recovery commands now quote branch names and paths so a shell treats them as literal text. The new tests and the rest of What changed (
New tests (
To run the tests, I first had to install dependencies: There's no preview because nothing visible changed beyond the quoting inside a recovery command. Separate from F4, not changed: a branch name can legally contain a backtick, which would end the Markdown code span early wherever the command is shown. The shell quoting stays correct, but the displayed command could look cut off. Also, 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…h names and paths so a shell treats them as literal text. The new tests and the rest of `test/pushSalvage.test.ts` and `test/issueJobPushSalvage.test.ts` pass (13/13), and lint and typecheck are clean. I fixed F4: the generated recovery commands now quote branch names and paths so a shell treats them as literal text. The new tests and the rest of `test/pushSalvage.test.ts` and `test/issueJobPushSalvage.test.ts` pass (13/13), and lint and typecheck are clean. **What changed** (`packages/core/src/git/pushSalvage.ts`) - **New helper:** `quoteShellArgument` wraps a value in POSIX single quotes and escapes any embedded `'` as `'\''`. Simple values like `2736/salvage` or `refs/propr/rescue/task-1` stay unquoted so the message is still easy to read, and an empty value becomes `''`. - **All three recovery commands use it:** - **Rescue ref:** the ref and the branch in `git fetch origin <ref> && git checkout -B <branch> FETCH_HEAD`. - **Bundle:** the bundle path and the branch in `git fetch <bundle> HEAD && git checkout -B <branch> FETCH_HEAD`. - **Retained worktree:** `git -C <worktree> push origin <refspec>`, with `HEAD:refs/heads/<branch>` quoted as one whole argument. `buildRecoveryInstruction` is the only place these commands are built. The GitHub comment, task UI and CLI all show the text it produces, so they all get the fix. **New tests** (`test/pushSalvage.test.ts`) - **Exact output:** checks each rung's command for a valid branch name `fix;id>pwned;#it's`, a bundle path containing a space and `$HOME`, and a worktree path containing a space and `;`. - **Real shell run:** writes a real bundle and a real worktree into folders whose names contain a space, `;` and `'`, then runs the bundle and worktree commands through `sh -c` with the branch `fix;id>pwned;#`. It checks that the branch is created under its exact name pointing at the agent's commit, and that no `pwned` file appears. - With the old command building put back temporarily, both new tests fail and the other 10 still pass. To run the tests, I first had to install dependencies: `node_modules` was missing, so I ran the existing `.propr/setup.sh`. No setup files changed. There's no preview because nothing visible changed beyond the quoting inside a recovery command. **Separate from F4, not changed:** a branch name can legally contain a backtick, which would end the Markdown code span early wherever the command is shown. The shell quoting stays correct, but the displayed command could look cut off. Also, `propr-ui/e2e/task-details-push-failure.pw.ts` contains a hard-coded unquoted example of the instruction text; it only uses a plain branch name, so it's still accurate. PR: #2755 Comment by: @propr-ultrafix (ID: 0) Model: claude-opus-5-5
|
CI failed: Validate Changes Please investigate and fix this CI failure.
Failure evidence
|
Checks FailedValidation failed during setup, tests, CLI packaging, linting, or build checks. View Logs |
|
✅ Applied the requested follow-up changes in commit f2bb868 Processed 2 comments:
Summary of ChangesI fixed the CI failure. The core package lint failed on one unnecessary escape ( After the change, the core package lint ( To run those checks, I had to install dependencies and build 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
… unnecessary escape (`\/`) in the shell-quoting regex at `packages/core/src/git/pushSalvage.ts:100`. I removed it, and the regex is now `/^[A-Za-z0-9_/.:@%+=,-]+$/`. A `/` inside a character class doesn't need escaping, so the regex matches exactly the same strings as before. I fixed the CI failure. The core package lint failed on one unnecessary escape (`\/`) in the shell-quoting regex at `packages/core/src/git/pushSalvage.ts:100`. I removed it, and the regex is now `/^[A-Za-z0-9_/.:@%+=,-]+$/`. A `/` inside a character class doesn't need escaping, so the regex matches exactly the same strings as before. After the change, the core package lint (`eslint .` in `packages/core`) passes. The 13 tests in `test/pushSalvage.test.ts` and `test/issueJobPushSalvage.test.ts` also pass. I didn't re-run the rest of the CI checks. To run those checks, I had to install dependencies and build `@propr/shared` first, because the workspace had neither. This change has no visible effect, so I didn't create any previews. PR: #2755 Comment by: @propr-dev[bot] (ID: 6007358571) Comment by: @github-actions[bot] (ID: 6007358999) Model: claude-opus-5-5
|
/ultrafix goal=8 max=3 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 3) First action:
|
|
/review |
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
|
/fix F9 |
|
✅ Applied the requested follow-up changes in commit daaac9d
Summary of ChangesI fixed F9: the bundle sweep can no longer delete a rescue bundle that a worker writes into a directory the sweep has just emptied. I added a regression test that fails on the previous code and passes now. Lint is clean for The fix is in
Tests in
Callers checked: the only caller is the daemon sweep in Setup: dependencies weren't installed in this workspace, so I ran This change has no visual effect, so there's no preview. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…bundle that a worker writes into a directory the sweep has just emptied. I added a regression test that fails on the previous code and passes now. Lint is clean for `packages/core`, the typecheck shows no errors in `rescueRefs.ts`, and the salvage suites (`rescueRefHygiene`, `pushSalvage`, `issueJobPushSalvage`) pass. I fixed F9: the bundle sweep can no longer delete a rescue bundle that a worker writes into a directory the sweep has just emptied. I added a regression test that fails on the previous code and passes now. Lint is clean for `packages/core`, the typecheck shows no errors in `rescueRefs.ts`, and the salvage suites (`rescueRefHygiene`, `pushSalvage`, `issueJobPushSalvage`) pass. **The fix** is in `pruneRescueBundles` in `packages/core/src/git/rescueRefs.ts`: - **Empty directories:** the sweep used to list a directory, see it was empty, then delete it and everything in it. It now uses a delete that only works on empty directories (`fs.rmdir`). If a worker writes a bundle in between, the delete fails with `ENOTEMPTY` and the bundle stays. That error, `EEXIST` and `ENOENT` (the directory is already gone) are ignored. The same helper runs at every directory level the sweep visits. - **Directories that vanish mid-sweep:** listing a directory that has disappeared returns nothing instead of stopping the whole sweep. **Tests** in `test/rescueRefHygiene.test.ts`: - One test follows the review's scenario. The last expired bundle is deleted, then a worker writes a new bundle into that directory just before the sweep removes it. The test checks the new bundle survives. - A second test makes a directory disappear before the sweep removes it and checks the sweep still finishes. It also passes on the old code, so it only covers the new error handling and isn't a regression test. **Callers checked:** the only caller is the daemon sweep in `src/daemon/rescueRefSweep.ts`, which needs no change. On the worker side, `salvagePush` in `pushSalvage.ts` creates the directory and then writes the bundle. If the sweep removes the still-empty directory between those two steps, writing the bundle fails. That doesn't lose work, because the salvage then keeps the worktree instead. This window is a race between two separate processes that share no lock, and making it atomic was out of scope, so I left it. **Setup:** dependencies weren't installed in this workspace, so I ran `npm ci` before the tests would run. No setup files changed. This change has no visual effect, so there's no preview. PR: #2755 Comment by: @integry (ID: 6009682003) Model: claude-opus-5-5
|
/review |
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a coherent salvage ladder and exposes recovery details across task history, GitHub comments, the CLI, and the UI. It needs changes before merge because the rescue push bypasses an existing credential boundary and remote-ref pruning depends on an unrelated local Git repository. ✅ Verified bundle recovery — Bundles are fetched into an empty repository and checked against the expected HEAD before being accepted as successful salvage. ✅ Useful failure reporting — Structured rejection diagnoses and recovery instructions propagate through the changed failure handlers and consumers. ✅ Safer retention markers — Exclusive temporary-file creation followed by rename avoids writing through a repository-controlled marker symlink. This review is based on static inspection only; no commands were run. No current-head check runs were reported. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F10: 🔴 Rescue pushes bypass credential-helper isolation
F11: 🔴 Remote-ref deletion requires a local repository
SuggestionsThese are optional follow-ups and are not sent to S7: 🟢 Align bundle documentation with implementation
ScoreThe salvage flow and recovery verification are substantial improvements, but the credential boundary regression and broken pruning outside a checkout require correction before merge. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
/fix F10 F11 |
|
✅ Applied the requested follow-up changes in commit 0c09c7b
Summary of ChangesI fixed F10 and F11. Each now has a regression test that fails on the previous code and passes with the fix. F10: the rescue push now authenticates like a normal push (
F11: deleting expired rescue refs no longer depends on the daemon's working directory (
Tests
Results
Limits
Separate pre-existing issue (not changed): 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ils on the previous code and passes with the fix. I fixed F10 and F11. Each now has a regression test that fails on the previous code and passes with the fix. **F10: the rescue push now authenticates like a normal push** (`packages/core/src/git/pushSalvage.ts`) - `pushRescueRef` now applies `configureGitAuthentication` to its own Git client. That passes the token as a process-local `github.com` auth header and clears credential helpers instead of running them. - It pushes to the plain repository URL; the token is no longer embedded in it. **F11: deleting expired rescue refs no longer depends on the daemon's working directory** (`packages/core/src/git/rescueRefs.ts`) - Each listing and deletion now runs inside a temporary empty Git repository that is deleted afterwards. `git push` needs a repository to run in, and the daemon's directory may not be one. - The sweep had the same F10 defect: the token was embedded in the URL with no helper isolation. I applied the same fix there, so both commands use the process-local auth and the plain URL. **Tests** - I added `test/gitHttpServer.ts`, a small test server that serves repositories over HTTP. Like GitHub, it asks for credentials and records any it receives. Tests against a local folder can't reach that code path. - **Rescue push** (`test/pushSalvage.test.ts`): a repository-configured credential helper is never run, and the token is never sent as URL credentials. - **Sweep outside a Git repository** (`test/rescueRefHygiene.test.ts`): with the working directory set to a non-repository folder, the expired ref is deleted. On the previous code this failed with `fatal: not a git repository`. - **Sweep credentials**: the same check as the rescue push, for listing refs. - On the previous code, the rescue-push and sweep-credentials tests failed because the token was sent as URL credentials. **Results** - The three salvage suites (`pushSalvage`, `rescueRefHygiene`, `issueJobPushSalvage`) pass, 28/28. They need `PROPR_DEMO_MODE=true`; without it they abort on the missing GitHub-auth configuration. - Lint passes for `packages/core`. - The typecheck shows no errors in the changed files. The remaining errors elsewhere come from `@propr/shared` not being built in this workspace. - I ran `npm ci` because dependencies weren't installed; no setup files changed. **Limits** - I couldn't show a helper actually running on the old code: the Git version here (2.39) didn't call it in my manual test. The tests prove the token is no longer sent as URL credentials, and the fix removes the helpers whatever the Git version does. - The fixed rescue push and sweep now only send the token to `github.com`, so the new tests can only check that nothing leaks, not that a push succeeds. A successful rescue push is still covered by the existing local-remote test. **Separate pre-existing issue (not changed):** `remoteHasAnyRefs` in `packages/core/src/git/seedCommit.ts` also puts the token in the URL for `ls-remote` without clearing credential helpers. This PR doesn't touch that file, so I left it alone. PR: #2755 Comment by: @integry (ID: 6009990431) Model: claude-opus-5-5
|
/review |
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a coherent salvage ladder, structured push diagnostics, recovery instructions, and retention cleanup. It needs changes before merge because repository-controlled content can activate indefinite worktree retention. ✅ Verified bundle recovery — Bundle creation is followed by a fetch into an empty repository and a HEAD comparison before salvage is reported successful. ✅ Consistent diagnostics — Structured push failures reach task history, CLI output, UI details, and GitHub failure comments. ✅ Credential isolation — Rescue pushes and remote pruning use process-local authentication with credential helpers cleared. This review used static analysis of the supplied code. No commands or tests were run. No current-head check runs were reported. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F12: 🔴 Repository files can disable cleanup indefinitely
SuggestionsThese are optional follow-ups and are not sent to S8: 🟢 Update the bundle documentation
S9: 🟢 Consider pruning unmonitored fork rescuesPublication correctly targets the PR’s head repository, including forks, while ScoreThe implementation has substantial focused coverage and clear recovery reporting, but the new retention trust issue requires correction before merge. Current-head validation remains unreported. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
/fix F12 |
|
✅ Applied the requested follow-up changes in commit 4caa013
Summary of ChangesI fixed F12. A What changed
Tests (
Design note: I first also tied each record to the directory's inode, but Linux reused the inode as soon as the directory was recreated, so that check didn't work. I dropped it. Each job's worktree path already includes a timestamp and a random suffix, so two jobs never share a path. Separate issues I noticed but didn't fix (outside F12, and older than this PR):
No preview images were made, since nothing visible changed. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…epository can no longer stop a worktree from being cleaned up. I fixed F12. A `.retention-info.json` file committed to a repository can no longer stop a worktree from being cleaned up. **What changed** - **Where the decision lives:** when the last salvage step keeps a worktree, the worker now writes a record into its own storage outside the checkout. The record is named after the worktree's real path and repeats that path inside it. The location is a new setting, `PUSH_RESCUE_WORKTREE_RECORD_DIR`, which defaults to `<DATA_DIR>/rescue-worktrees` (`rescueRefs.ts`). - **The file in the worktree:** `writeSalvageRetentionMarker` still writes `.retention-info.json` with the same symlink-safe method, but only for information. If that write fails, it logs a warning instead of failing the step. A failure to write the real record still fails the step. - **Both cleanup paths:** - `cleanupWorktree` decides through `isSalvageRetainedWorktree`, which now reads only the worker's record. - `processWorktreeItem` (the expiry sweep) checks the record first. An active record keeps the worktree. An expired one removes both the worktree and the record. A salvage marker in the worktree with no record falls through to the old date-based handling, so a forged `scheduledCleanup: null` is treated as expired and deleted. - **Record cleanup:** `cleanupExpiredWorktrees` also deletes records whose worktree no longer exists. A record is only ever written for a worktree that already exists, so a missing path means the worktree is gone for good. - The docs and CHANGELOG now describe where the record lives. **Tests** (`test/pushSalvage.test.ts`) - A forged marker is deleted by both `cleanupWorktree` (with `always_delete` on a successful job) and the expiry sweep. - A salvaged worktree stays retained after its `.retention-info.json` is deleted. Once an operator deletes the worktree, the sweep removes its record, so a new directory at the same path with a forged marker is cleaned up. - Both tests fail on the old code and pass now. - The three salvage suites (`pushSalvage`, `issueJobPushSalvage`, `rescueRefHygiene`) pass, 30/30, and lint is clean for the changed core files. - Typecheck shows no errors in these files; its only errors are that `@propr/shared` isn't built here. I ran `npm ci --ignore-scripts` first because dependencies weren't installed; no setup files changed. **Design note:** I first also tied each record to the directory's inode, but Linux reused the inode as soon as the directory was recreated, so that check didn't work. I dropped it. Each job's worktree path already includes a timestamp and a random suffix, so two jobs never share a path. **Separate issues I noticed but didn't fix (outside F12, and older than this PR):** - The expiry sweep still trusts the old date-based `.retention-info.json` written for `keep_on_failure` / `keep_for_hours`. A committed file with a far-future `scheduledCleanup` or an unparseable date would keep that worktree from being swept. - Nothing in production code calls `cleanupExpiredWorktrees`; it's only exported. So the expiry sweep and its record cleanup only run where someone invokes it. No preview images were made, since nothing visible changed. PR: #2755 Comment by: @integry (ID: 6011608194) Model: claude-opus-5-5
|
/review |
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a coherent salvage ladder and exposes push diagnoses through task history, GitHub comments, the CLI, and UI. It is merge-ready within the reviewed scope. ✅ Recoverable bundles — Bundle creation includes HEAD’s full history and verifies recovery into an empty repository before declaring success. ✅ Protected retention — Cleanup honors worker-controlled records outside the checkout; repository-provided markers cannot independently claim salvage retention. ✅ Useful failure reporting — Structured failure metadata preserves the rejection class, unblock URLs, and recovery instructions across the changed consumers. This was a static review of the supplied diff and context. No commands or tests were run. No current-head check runs were reported. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S10: 🟢 Align bundle documentationIn ScoreThe implementation addresses the objective with substantial targeted coverage and no verified merge blockers. Runtime validation remains unconfirmed in this review. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
Local verification on head One non-blocking observation: |
|
✅ Applied the requested follow-up changes in commit d84e245 Summary of ChangesRescue pushes and rescue-ref pruning now work on a host that exports The fix: both the salvage path ( Regression test: I added "git prune dependencies work on a host that exports askpass programs" to Verification:
To get tests running I ran 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…t exports `SSH_ASKPASS` or `GIT_ASKPASS`. The two suites you flagged pass with both variables set. Rescue pushes and rescue-ref pruning now work on a host that exports `SSH_ASKPASS` or `GIT_ASKPASS`. The two suites you flagged pass with both variables set. **The fix:** both the salvage path (`pushSalvage.ts`) and the prune path (`rescueRefs.ts`) build their git environment in one shared function, `configureGitAuthentication` in `packages/core/src/git/repoBranching.ts`. It copies the host environment and already removed the editor and pager variables that simple-git rejects. It now also removes `GIT_ASKPASS` and `SSH_ASKPASS`. Credentials come only from the injected authorization header, so an askpass program is never needed. Because this function is shared, the normal branch push and the clone/fetch authentication also stop inheriting these variables; they would have hit the same refusal on such a host. **Regression test:** I added "git prune dependencies work on a host that exports askpass programs" to `test/rescueRefHygiene.test.ts`. It sets both variables, prunes an expired rescue ref through the real git path, and restores the environment afterwards. **Verification:** - **Without the fix:** with `SSH_ASKPASS` set, `pushSalvage` and `rescueRefHygiene` fail with your exact error, and the new test fails on `GIT_ASKPASS` even with nothing set in the shell. - **With the fix:** with both variables set, the `rescueRefHygiene`, `pushSalvage` and `issueJobPushSalvage` suites pass, 31/31. - **Lint:** core lint is clean. The root eslint config doesn't lint the changed files, so that check doesn't cover them. To get tests running I ran `npm ci` and built `@propr/shared`, which changed no files. I didn't add a preview because nothing in this change is visible to a user. PR: #2755 Comment by: @integry (ID: 6011761673) Model: claude-opus-5-5
|
/merge |
|
🔀 Resolved merge conflicts from Conflicting Files
Resolution SummaryI resolved the conflicts in both files, and no conflict markers remain anywhere in the repository. A syntax-only TypeScript check of 1.
|
…agent-work-before-20261005-2330-ait Automatically resolved merge conflicts after merging target branch into PR branch. Resolved conflicts in: - CHANGELOG.md - packages/core/src/git/repoBranching.ts PR: #2755 Model: claude-opus-5-5
Full Test Suite ResultsValidation failed during: Test shard (shard 3).
View shard 3/4 outputDetails truncated; see the uploaded artifacts for complete failure rows and logs. |
|
✅ Applied the requested follow-up changes in commit 40f1755 Summary of ChangesI fixed the shard 3 failure. It was a flaky test, not a bug in this PR. Neither the test nor What failed: one test in Fix: in Verification:
To run the tests locally I installed dependencies with This doesn't change anything visible, so there's no visual preview. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
… in this PR. Neither the test nor `sqliteRetry.ts` is changed on this branch.
I fixed the shard 3 failure. It was a flaky test, not a bug in this PR. Neither the test nor `sqliteRetry.ts` is changed on this branch.
**What failed:** one test in `packages/core/test/usageTips.test.ts`, "separate SQLite connections serialize distinct events and deduplication survives reopening", stopped with `BEGIN IMMEDIATE; - database is locked` (`SQLITE_BUSY`) after 7.75s on the CI host. The test has two connections race to write the same SQLite file. It gave the retry layer only 1 second in total across 6 attempts, so if the other connection held the write lock for more than about a second, the test gave up. A slow disk write on a busy runner can easily take that long.
**Fix:** in `packages/core/test/usageTips.test.ts`, I changed the test's retry settings from `{ maxTotalMs: 1000 }` to `{ maxAttempts: 50, maxTotalMs: 30_000 }`, with a short comment saying why. The test exists to check that writes are serialized and deduplicated. The retry limits themselves are covered in `sqliteRetry.test.ts`, so a larger budget here hides nothing.
**Verification:**
- **Reproduced the CI error:** I kept the write lock held from a third connection for 2 seconds. With the old settings the write failed with the same `BEGIN IMMEDIATE; - database is locked` error. With the new settings it waited and succeeded after about 2.2s.
- **Full file:** all 23 tests in `usageTips.test.ts` pass.
- **Under CPU load:** the old version passed 8 out of 8 runs, so heavy CPU alone doesn't trigger it. That fits a slow disk write being the cause.
- **Not done:** I haven't re-run the full suite or shard 3.
To run the tests locally I installed dependencies with `npm ci --ignore-scripts`, which skipped building the native SQLite module, so I rebuilt it with `npm rebuild better-sqlite3`. The lockfile is unchanged and the only modified file is the test.
This doesn't change anything visible, so there's no visual preview.
PR: #2755
Comment by: @github-actions[bot] (ID: 6012402601)
Model: claude-opus-5-5
AI Implementation Summary
Closes #2736
Branch:
2736/claude-opus-5-5-salvage-agent-work-before-20261005-2330-aitCommits: ✅ Changes committed (3fcb835)
AI Processing Completed
Execution Details:
Summary:
I've implemented #2736. When the final push from a worktree fails, ProPR now saves the agent's commits before deleting the worktree, and it tells you why the push was rejected and how to get the work back. Lint and typecheck pass, 31 affected server suites pass, and the new CLI, UI and Playwright tests pass. I haven't run the full repository test suite.
The salvage ladder. This runs in issue implementation runs, PR follow-ups (which covers
/fixand ultrafix cycles) and merge-conflict jobs. It runs before the job's existing cleanup and lock release, and the success path is unchanged. When the push fails, ProPR tries these in order:refs/propr/rescue/<taskId>on the same repository.<DATA_DIR>/rescue/<owner>/<repo>/<taskId>.bundle. The directory can be changed withPUSH_RESCUE_BUNDLE_DIR..retention-info.jsonmarker, whateverWORKTREE_RETENTION_STRATEGYsays. Its HEAD is detached so the next job on the same PR can still check out the branch.The rung that succeeded is recorded on the task timeline. The task then fails with a message that leads with the rejection class, the unblock URL and the exact recovery command.
Rejection diagnosis. Git's push output is classified as
push_protection,ruleset_or_branch_protection,non_fast_forward,auth,networkorunknown. The diagnosis is stored in the failed history entry's metadata rather than a new database column. It shows up in three places:propr task get: a "Push Rejection" section, andpushFailurein--json.Rescue-ref cleanup. The daemon deletes rescue refs and bundles older than
PUSH_RESCUE_RETENTION_DAYS(default 14) at startup and every 6 hours;0turns this off. It runs alongside the existing draft-context sweep rather than as a newproprcommand. Rescue refs are ignored by merge-conflict detection on push events and refused as task branches.Behaviour changes to be aware of:
Tests added: classifier tests on realistic git output for each class. Ladder tests covering each rung: rescue-ref and bundle recovery run against real local git remotes, the other cases use fakes. Tests that rescue refs are ignored and pruned correctly, plus the CLI, UI component and a Playwright page test. I also updated five existing tests whose mocks of
@propr/corelist every export, and pointed one test's bundle directory at a temp folder.Docs:
maintenance.md,troubleshooting.md,git-management.md,configuration-reference.mdand a CHANGELOG entry under Unreleased.The new logic is mainly in
packages/core/src/git/pushSalvage.tsandpushRejection.ts. I captured desktop and mobile screenshots of the new timeline panel as preview evidence.Detailed Logs:
a158aa3e-572b-438c-8f39-94dba8a9caf9Log files stored at:
/tmp/claude-logs/issue-2736-2026-10-05T23-58-38-913Z-conversation.json/tmp/claude-logs/issue-2736-2026-10-05T23-58-38-913Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #2736.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!
Visual preview
Rejected push on the task timeline (desktop)
Task detail timeline for a task whose final push was blocked by secret scanning push protection: the salvage event names the rescue ref, and the failed step shows the classification, the unblock URL verbatim and the recovery command.
Original unavailable: managed storage is unavailable or the upload has expired.
Rejected push on the task timeline (mobile)
The same push rejection diagnosis and recovery instruction at 390px width.
Original unavailable: managed storage is unavailable or the upload has expired.