fix(pr-preservation): DECOMPOSED - add archived files to git (from #4857)#4967
fix(pr-preservation): DECOMPOSED - add archived files to git (from #4857)#4967AceHack wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 282ffc8369
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| join(outDir, `PR-${String(args.pr).padStart(4, "0")}-${makeSlug(fetched.pr.title ?? "untitled")}.md`); | ||
|
|
||
| writeFileSync(path, content); | ||
| spawnSync("git", ["add", path]); |
There was a problem hiding this comment.
Fail fast when staging archived file fails
The new staging step calls spawnSync("git", ["add", path]) but never checks whether it succeeded, and main still returns 0. If git add fails (for example due to an index lock, permissions, or missing git on PATH), the script reports success while leaving the archive unstaged, which defeats the preservation guarantee this change is meant to add. Please validate the spawn result and return a non-zero exit code on failure.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR primarily aims to fix tools/pr-preservation/archive-pr.ts so that newly created/updated PR archive markdown files are staged in git, preventing the worktree from staying dirty after archiving.
Changes:
- Stage the generated PR archive file by running
git addafter writing it. - Add a new preserved PR discussion document under
docs/pr-discussions/. - Add/update several backlog row files and adjust the Riven Cursor heartbeat script (note: these additional changes expand scope beyond the PR description).
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/pr-preservation/archive-pr.ts | Adds a git add step after writing the archive markdown file. |
| docs/pr-discussions/PR-4853-shard-2026-05-24-1902z-otto-vscode-bg-worker-lior-lane-fleet.md | Adds a preserved PR discussion archive document. |
| docs/backlog/P3/B-0002-otto-287-noether-formalization.md | Adds a children list to the B-0002 row. |
| docs/backlog/P3/B-0002.1-noether-formalization-step1.md | Adds a new child backlog row for step 1 of B-0002. |
| docs/backlog/P3/B-0002.2-noether-formalization-step2.md | Adds a new child backlog row for step 2 of B-0002. |
| docs/backlog/P3/B-0002.3-noether-formalization-step3.md | Adds a new child backlog row for step 3 of B-0002. |
| docs/backlog/P3/B-0002.4-noether-formalization-step4.md | Adds a new child backlog row for step 4 of B-0002. |
| .cursor/bin/riven-loop-tick.ts | Changes the 15-minute gate invocation behavior/CLI usage and logging. |
|
|
||
| writeFileSync(path, content); | ||
| spawnSync("git", ["add", path]); | ||
| process.stdout.write( | ||
| `wrote ${path} (${String(content.length)} bytes, ${String(fetched.threads.length)} threads, ${String(fetched.reviews.length)} reviews, ${String(fetched.comments.length)} comments)\n`, |
| last_updated: 2026-05-02 | ||
| depends_on: [] | ||
| composes_with: [] |
| effort: M | ||
| ask: maintainer Lior 2026-05-24 | ||
| created: 2026-05-24 | ||
| last_updated: 2026-05-24 |
| ask: maintainer Lior 2026-05-24 | ||
| created: 2026-05-24 | ||
| last_updated: 2026-05-24 | ||
| depends_on: [B-0002.1] | ||
| composes_with: [] |
| ask: maintainer Lior 2026-05-24 | ||
| created: 2026-05-24 | ||
| last_updated: 2026-05-24 | ||
| depends_on: [B-0002.2] | ||
| composes_with: [] |
| ask: maintainer Lior 2026-05-24 | ||
| created: 2026-05-24 | ||
| last_updated: 2026-05-24 | ||
| depends_on: [B-0002.3] |
| if (elapsed >= agentIntervalMs) { | ||
| const prNum = Number(prCount) || 0; | ||
| const workMode = prNum === 0 ? "pickup" : "drain"; | ||
| agentStatus = "running"; | ||
| log(`riven work cycle start run_id=${runId} mode=${workMode} open_prs=${prNum}`); | ||
| log(`riven agent gate start run_id=${runId}`); | ||
|
|
||
| if (dryRun) { | ||
| log(`dry-run: would run riven ${workMode}`); | ||
| log(`dry-run: would run agent gate`); |
|
This PR is a blob and contains multiple unrelated changes. Please decompose this PR into smaller, atomic PRs. |
This PR is a decomposition of #4857, containing only the fix to the 'archive-pr.ts' script.