Add agent stack sync helper - #91
Conversation
|
Warning Review limit reached
Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds a new Changesagent-stack sync feature
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef9e57a283
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
bin/agent-stack-test.bash (1)
103-211: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd a cleanup trap to remove temp directories.
Each test creates temp dirs via
mktemp -dbut never removes them, leaving artifacts behind on every run. Add atrapto clean up, or remove dirs at the end of each test function.♻️ Suggested cleanup approach
#!/usr/bin/env bash set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +TEST_TMPDIRS=() +cleanup() { + for d in "${TEST_TMPDIRS[@]}"; do + rm -rf "$d" + done +} +trap cleanup EXIT +Then in each test, after
tmp="$(mktemp -d)", add:tmp="$(mktemp -d)" + TEST_TMPDIRS+=("$tmp")🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bin/agent-stack-test.bash` around lines 103 - 211, The test helpers in agent-stack-test.bash leave mktemp -d directories behind in each of the sync test functions, so add cleanup using a trap or explicit removal for the temp root created in each test. Update the affected functions such as test_sync_clones_installs_and_links_the_stack, test_sync_refuses_dirty_repo_without_force_stash, test_sync_refuses_non_main_repo, and test_sync_force_stash_allows_dirty_main_repo so tmp is always removed even on failure, without changing the test assertions or flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bin/agent-stack-test.bash`:
- Line 200: The hardcoded redirect target in the agent-stack test script should
be replaced with a unique temporary file to avoid collisions and symlink risks.
Update the `--force-stash` output handling in `bin/agent-stack-test.bash` to
create a temp file with `mktemp`, redirect stdout there, and ensure the file is
removed during cleanup; use the surrounding script flow and the `--force-stash`
invocation to locate the change.
- Line 152: The failure test for the agent-stack sync command is missing the
runtime root setup, so it can still create ~/.agent-workflows before sync fails.
Update the failing invocations in the agent-stack test script around the sync
command to pass --runtime-root in both failure cases, and keep --target removed
since it is unused with --no-install. Use the agent-stack sync call and
prepare_runtime_root context to locate the affected test cases.
In `@docs/superpowers/plans/2026-07-08-agent-stack-sync.md`:
- Around line 16-18: The plan entries in the agent stack sync doc use hard-coded
`/Users/justin/...` paths, which makes the documentation non-portable and
exposes a personal workstation path. Update the listed items to use
repo-relative paths or a generic placeholder root instead, and make the same
replacement for the related entries noted elsewhere in the document so the paths
consistently reference the repo rather than a specific machine.
In `@README.md`:
- Around line 65-83: The bootstrap guidance in README is incomplete for
first-time users who do not already have agent-stack on PATH. Update the section
around the agent-stack sync helper to explicitly tell readers to run the helper
from the cloned checkout via bin/agent-stack sync, or to add that checkout’s
bin/ directory to PATH before invoking agent-stack. Keep the existing references
to the stack sync helper and the initial clone step, but make the startup
sequence unambiguous so users can reach the sync command from a fresh install.
---
Nitpick comments:
In `@bin/agent-stack-test.bash`:
- Around line 103-211: The test helpers in agent-stack-test.bash leave mktemp -d
directories behind in each of the sync test functions, so add cleanup using a
trap or explicit removal for the temp root created in each test. Update the
affected functions such as test_sync_clones_installs_and_links_the_stack,
test_sync_refuses_dirty_repo_without_force_stash,
test_sync_refuses_non_main_repo, and
test_sync_force_stash_allows_dirty_main_repo so tmp is always removed even on
failure, without changing the test assertions or flow.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c1839599-f986-401d-946c-3a06379e8901
📒 Files selected for processing (8)
README.mdbin/agent-stackbin/agent-stack-test.bashbin/install-agent-workflowsbin/install-agent-workflows-test.bashbin/validatedocs/installation-and-upgrades.mddocs/superpowers/plans/2026-07-08-agent-stack-sync.md
Review: Add agent stack sync helperOverview: adds Main concern: portability
Other findings
Nits
|
Address-review summaryScan scope: full PR history. Mattered
Optional
Skipped
Next default scan starts after this comment. Say |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 862825123e
ℹ️ 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".
ReviewOverviewAdds Code quality
Issues found (posted inline)
Portability note (non-blocking)Per SecurityNo injection or unsafe-eval concerns; all path/URL handling is properly quoted and argument-based (no Nice addition overall — solid safety posture for a script that mutates a developer's local checkouts. |
Address-review summaryScan scope: since previous summary at 2026-07-08T04:30:09Z. Mattered
Optional
Skipped
Next default scan starts after this comment. Say |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac79520a07
ℹ️ 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".
Review SummaryReviewed the Overall: solid, defensively-written bash — good use of Left 3 inline comments:
No issues found in |
Address-review summaryScan scope: since previous summary at 2026-07-08T04:41:12Z. Mattered
Optional
Skipped
Next default scan starts after this comment. Say |
Address-review summaryScan scope: since previous summary at 2026-07-08T04:50:17Z. Mattered
Optional
Skipped
Next default scan starts after this comment. Say |
Review SummaryThis PR adds Overall: well-scoped and unusually well-tested for a bash script. No blocking issues found. Code quality / correctness
Security
Portability (skills/workflows genericism)
Docs
Tests
No shell/Ruby helper safety issues found beyond the one minor note above. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ebcbaeabe
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d01caddbf
ℹ️ 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".
Review: Add agent stack sync helperOverviewAdds Strengths
Portability (per AGENTS.md editing rules)This PR does not touch Other notes (posted inline)
No blocking correctness or security issues found otherwise. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09ed4c8a6d
ℹ️ 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".
Review: Add agent stack sync helperOverview: Adds Portability (AGENTS.md "Editing Rules"): No violation found. The diff only touches Strengths:
Possible issues (see inline comments):
Nothing else stood out as a correctness, security, or performance concern — this is a well-tested, conservatively-designed addition. |
Review SummaryWhat this PR does: Adds Portability (AGENTS.md Editing Rules)No changes touch Code quality / security (shell safety in
|
Address-review summaryScan scope: review activity since previous summary at 2026-07-08T04:57:45Z. Mattered
Optional
Skipped
Validation: local Next default scan starts after this comment. Say |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0dc958075c
ℹ️ 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".
| compat_root="$(physical_dir "$compat_root")" | ||
| reject_compat_root_inside_source_checkout "$compat_root" | ||
| reject_source_root_inside_compat_alias "$source_root" | ||
| runtime_root="$(physical_dir "$runtime_root")" |
There was a problem hiding this comment.
Reject runtime roots inside managed checkouts
When --runtime-root is placed under a managed checkout, e.g. --source-root /tmp/src --runtime-root /tmp/src/agent-workflows/.agent-workflows, this pre-sync canonicalization calls mkdir -p and creates /tmp/src/agent-workflows before sync_repo runs, so the later clone is refused as a non-git path and the blocking directory is left behind. Normalize without creating and reject runtime roots inside managed checkout paths, or defer creating the runtime root until after checkout validation.
Useful? React with 👍 / 👎.
| had_legacy_alias=true | ||
| fi | ||
|
|
||
| "$repo/bin/agent-coord" bootstrap --install-dir "$agent_coord_install_dir" |
There was a problem hiding this comment.
Protect existing agent_coord before bootstrap
When a user already has $agent_coord_install_dir/agent_coord, had_legacy_alias only prevents the post-bootstrap cleanup; it does not protect the file while agent-coord bootstrap runs. If bootstrap writes its legacy alias (the behavior expected by this cleanup and modeled in bin/agent-stack-test.bash), the custom command is overwritten and then kept, so the preexisting alias is not actually preserved. Move/restore the file around bootstrap or make bootstrap skip the alias when it already exists.
Useful? React with 👍 / 👎.
Summary
agent-stack syncas a hacker-friendly stack bootstrap/update helper~/srcthe default source checkout root,~/.agent-workflowsthe private runtime/config root, and~/codex/agent-reposcompatibility symlinksagent-stackalongside the existing workflow helper binariesValidation
bash -n bin/agent-stack bin/agent-stack-test.bash bin/install-agent-workflows bin/install-agent-workflows-test.bashgit diff --checkbash bin/agent-stack-test.bashbash bin/install-agent-workflows-test.bashbin/validateCodex Decision Log
~/srcand reserve~/.agent-workflowsfor runtime/config/cache/log/state.~/.agent-workflows/reposinstall mode without changing the contributor default.Summary by CodeRabbit
New Features
Documentation
Tests