Repository navigation
fix(work-items): target the fork, not gh's default, in fork checkouts - #18080
Conversation
The GitHub tracker adapter resolved its repository through gh's default, which a stock `gh repo clone` of a fork records as upstream, so tracker writes could land on the upstream repository. wit_resolve_repo now runs the shared target-repo.sh (canonical lib/target-repo.sh, synced into source-control and work-items per ADR 0019): the pushable fork wins, and undecidable remotes exit 3 with the gh repo set-default fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RAoAtUCUQcEWJH2ZdgUbP8
ai-hero-cli 0.13.0 keeps the course history on fork; the cherry-pick model-choice hold was released by its recheck at the workshop 07/08 tip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RAoAtUCUQcEWJH2ZdgUbP8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RAoAtUCUQcEWJH2ZdgUbP8
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1fa61a42a
ℹ️ 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".
Lane run report
Run 44963508489, attempt 1
Failed GitHub API callsNo failed call recorded by the run job's scripts. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RAoAtUCUQcEWJH2ZdgUbP8
|
claude-security-review reviewed Security review (incremental, blocking only): no security issues foundThis lane already reviewed an earlier head, so this pass reports only CRITICAL and IMPORTANT findings. I read every hunk of the 6 files that changed since What changed:
What I checked:
Spend: none. One extra read-only Embedded text: none found in the PR context. critical-findings: 0 |
|
claude-review reviewed Code review (incremental): PR #18080,
|
…bash 3.2 safe
target-repo.sh drops declare -A and ${x,,}, which the macOS system bash
3.2 lacks. wit_resolve_repo sources it in a subshell, so in CI its gh
calls go through the API-budget wrapper, then reads the chosen
repository's canonical full_name through wit_run_gh, as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RAoAtUCUQcEWJH2ZdgUbP8
No related issue: owner decisions Q131 (b) and Q138 (in a fork checkout, work-items and source-control target the fork, never upstream), applied in the cohort-005 workshop 01 re-step on the owner's approval to fix what is out of date.
Summary
In a fork checkout, the work-items GitHub adapter still left the target repository to
gh's default, which a stockgh repo cloneof a fork records as upstream, so creating or listing tracker items could hit the upstream repository. #15375 fixed this for pull requests only. The adapter now uses the same resolver. The Before We Start upstream record also gets two stale rows refreshed.session: AI Hero
Fix
target-repo.shmoves tolib/target-repo.shas a shared-library canonical (ADR 0019), with generated copies in source-control (same path as before, resolution unchanged) and the work-items GitHub adapter. It now defines its one URL helper itself, so the copies need no plugin-relativesource.target-repo.shno longer usesdeclare -Aor${x,,}, so it runs on the macOS system bash 3.2 the work-items plugin supports.wit_resolve_repowith no--reposources that copy in a subshell, so in CI itsghcalls keep the API-budget wrapper, and then reads the chosen repository's canonicalfull_namethroughwit_run_gh, as the old resolver did, so item ids carry GitHub's name, not a stale remote URL's. The resolution order:GH_REPOfirst, then the pushable fork, then the recorded default, then the sole GitHub remote. When the remotes name two or more GitHub repositories, none is a pushable fork of another, and nogh repo set-defaultis recorded, it exits3and prints the set-default fix instead of letting gh pick by remote name (Q138, "refuse only when the remotes cannot decide"). Each resolution printstarget repository: <owner>/<repo>on stderr.CONTRACT.md"Setup (binding file)" describes the new order.set-dimensions.shexecs the tracker, so both pass through).docs/upstream/aihero-before-we-start.md: the fork row says ai-hero-cli 0.13.0 keeps the course history (its changelog), and the cherry-pick model-choice row moves from hold to no change, because its recheck at the course tip that workshops 07 and 08 use already happened.Tradeoffs
github_repo_ofnow lives both in source-control'slib/github-remote.shand insidelib/target-repo.sh: the synced copies must be identical, and their relative paths to a pluginlib/differ, so the canonical cannotsourceone. The commit-time comment lint also stripped the canonical's header, and the resolution order now lives in the source-control provider README's "Target repository" section andCONTRACT.md.Verification
common.test.sh0 FAIL, including new cases: a fork checkout resolves to the fork, not upstream; a remote on an old repository name resolves to the canonical name; undecidable remotes exit 3 with the set-default fix; no GitHub remote falls back togh api. Bash 3.2 itself was not run (no 3.2 on this host); the bash-4 constructs are gone by grep.create-item.test.sh(its stub now answersrepo set-default --view),list-items.test.sh,get-field-options.test.shand the other work-items adapter suites: 0 FAIL.target-repo.test.sh15/15,branch-update-signals.test.sh, bothmonitor-poll.test.sh,evals/gh-forge.test.sh: 0 FAIL.scripts/sync-shared-copies.sh --check(1027 copies match) and--check-bump origin/main,scripts/check-cross-plugin-source-drift.sh --check, and shellcheck: clean..githubsuite, which CI runs.Related
🤖 Generated with Claude Code
https://claude.ai/code/session_01RAoAtUCUQcEWJH2ZdgUbP8