Conversation
…Amara 2026-04-29 packet Amara caught (via the 04:35Z+ trace) that autonomous-loop scripts were repeatedly hitting 'fatal: main matched multiple (2) remote tracking branches' and then continuing past the failure as if it succeeded — which produced wrong downstream working-tree state. Rule (generic, applies to ANY multi-remote repo, not just Zeta): Bare `main` is for humans. Automation uses explicit refs. Zeta-specific worked example: refs/remotes/origin/main (LFG-trunk) and refs/remotes/acehack/main (dev-mirror) both exist per the zero-divergence-fork double-hop workflow. Different SHAs during in-flight work is the normal state. Local safety-belt set: `git config checkout.defaultRemote origin` helps interactive use but is NOT a substitute for explicit refs in scripts. Per Aaron's note: future-Claude dropped into recovery on a DIFFERENT repo with multiple remotes will hit the same failure mode, so the memory file is framed generically with Zeta as worked example. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new durable memory entry documenting a generic automation rule for multi-remote Git repos: avoid ambiguous bare branch names (especially main) and use explicit refs to prevent scripts from silently operating on the wrong base state after a failed checkout.
Changes:
- Add new feedback memory describing the “bare
mainambiguity” failure mode and recommending explicit refs in automation. - Update
memory/MEMORY.mdto index the new memory entry near the top (newest-first).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| memory/feedback_bare_main_ambiguity_automation_discipline_explicit_refs_required_amara_2026_04_29.md | New memory file capturing the multi-remote main ambiguity failure mode and the explicit-ref automation rule. |
| memory/MEMORY.md | Adds an index entry linking to the new memory file. |
…n rule shard (#776) Two more PRs merged (#771, #773 — 14 total this session arc). PR #772 thread fixes (canonical-name consistency + softened catalog claim). PR #775 opened with the generic bare-main-ambiguity memory file (Amara packet). Branch creation now uses explicit 'git switch --detach refs/remotes/origin/main' per the new rule. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…ections (PR #775) Three Copilot findings on PR #775: 1. P1 internal inconsistency between 'never use bare main' rule and the local-main-tracking-origin example using 'git switch main'. Fixed by adding explicit explanation: bare 'git switch main' is safe ONLY when refs/heads/main exists locally and tracks origin (Git's lookup order finds the local ref first; the multi-remote guessing only fires when the bare name doesn't match a local ref). All other refs in the example reframed to fully-qualified refs/remotes/origin/main form. 2. P2 blank 'channel:' label — no actual frontmatter field; the line was prose continuation 'forwarded by Aaron through the maintainer channel:' and Copilot read it as a label. Removed the colon-style break by inlining: 'forwarded by Aaron through the maintainer channel (the live Claude Code CLI conversation surface):'. 3. P1 MEMORY.md entry too long — trimmed from full paragraph to one-liner per memory/README.md ~200-line cap discipline. The detailed content lives in the dedicated memory file. Amara's round-2 packet additions: - Hard-stop pattern (set -euo pipefail + explicit exit-1 on base-ref failure) — the actual bug Amara caught was 'fatal happened, loop continued', not just bare-main ambiguity. - Better fetch refspec form (refs/heads/main:refs/remotes/origin/main) to ensure the remote-tracking ref is refreshed exactly. - Pre-canonization search evidence section — recording the search terms used + the closest-hit non-fit so future-Claude can audit the search-before-canonizing decision. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa88011c2f
ℹ️ 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".
…und-2 thread fixes shard (#778) PR #776 merged. PR #775 round-2 fixes (internal consistency, inlined channel-label misread, MEMORY.md trim, hard-stop pattern, fetch refspec, pre-canonization search evidence). Amara's round-2 catch: the actual bug was continuing after fatal, not just ambiguity. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…+Gemini+Claude.ai+Alexa+Deepseek+Amara) Four substantive additions to the bare-main rule + a stronger distilled keeper: 1. **Defining 'stop the tick' (orchestrator vs shell-script distinction)**: set -euo pipefail is right for shells; the autonomous loop is an orchestrator that needs explicit failure propagation across multiple commands. Defines what 'stop the tick' means: mark FAILED + minimal failure note + no commit/PR + wait for next cron cycle (preserves liveness while preventing fast-failure loops). 2. **Concurrency caveat for the fetch/switch pattern** (Claude.ai catch): the fetch+switch gives an explicit base ref but NOT a globally stable base across parallel ticks. For tick-history shards: fine. For stateful PR work: record the base SHA at branch-creation and verify before merge-sensitive operations. 3. **Generalized shell-glob lesson**: zsh-glob handling generalizes to ALL ref patterns in automation. Quote ref patterns so Git receives the pattern, not the shell's expansion. 4. **Future-consolidation threshold** (Claude.ai + Amara catch): when automation-failure-mode memory files reach 5-10 entries, create or update a consolidated index at docs/automation/automation-pitfalls.md. Substrate-locality > duplicate retrieval paths at the folder level too. Stronger distilled keeper added: Topology is allowed. Ambiguity is expected. Continuing after fatal ambiguity is forbidden. The actual immune trigger is the post-fatal continuation, not the topology or the ambiguity — that's what makes this an operational bug, not just multi-remote infrastructure. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… explicit 'git switch refs/heads/main' (PR #775) Codex correctly flagged that the 'with a local main tracking origin' example used 'git switch main' (bare), which only works AFTER refs/heads/main already exists locally. On first-run scripts where the local branch hasn't been created yet, bare 'main' would still hit the multi-remote ambiguity fatal. Fix: use 'git switch refs/heads/main' explicitly. That form is unambiguous regardless of local state — it asks Git for the local-branch ref, never the remote-tracking namespace. Also replaced 'git branch --track ... 2>/dev/null || true' with 'git branch -f main ...' for unconditional idempotent local ref creation at the explicit start-point. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…additions shard (#781) Multi-AI packet (Ani+Gemini+Claude.ai+Alexa+Deepseek+Amara) landed four substantive additions to PR #775 in one commit: defining stop-the-tick (orchestrator vs shell semantics), concurrency caveat for fetch/switch, generalized shell-glob lesson, future-consolidation threshold. Stronger distilled keeper: 'Topology is allowed. Ambiguity is expected. Continuing after fatal ambiguity is forbidden.' Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96e7adfafa
ℹ️ 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".
…(PR #775 Codex P2 fix + #781 display-artifact) (#783) PR #775 Codex P2 fix: bare 'git switch main' replaced with 'git switch refs/heads/main' (unambiguous regardless of local state). Third round of refinement on the bare-main rule — each round caught a real edge case. PR #781 same display-artifact thread as #760/#777; resolved not-actionable. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…e 'git switch main' (Codex round-4 P1) Codex correctly flagged that 'git switch refs/heads/main' (non- detached form) is invalid: git switch in non-detached mode takes a branch NAME, not a fully-qualified ref. The correct sequence (which the original draft had right; my round-3 fix overcorrected): 1. git fetch origin refs/heads/main:refs/remotes/origin/main 2. git branch -f main refs/remotes/origin/main ← creates local branch at explicit ref FIRST (eliminating ambiguity) 3. git switch main ← safe NOW because refs/heads/main exists; lookup-order finds local ref first Updated explanation to cover the three valid switch forms: - git switch <name> non-detached, branch-name only - git switch --detach <ref> detached HEAD, accepts any ref - git checkout <name> older form, same ambiguity concerns For new feature branches: git switch --detach refs/remotes/origin/main + git switch -c <new-branch>. This is round 4 of refinement on the bare-main rule — Codex caught my own overcorrection. Each round catches a real edge case the prior round missed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea131771ff
ℹ️ 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".
| git fetch acehack main --quiet | ||
| git switch --detach refs/remotes/acehack/main |
There was a problem hiding this comment.
Fetch AceHack main with explicit destination refspec
The AceHack snippet fetches with git fetch acehack main and then checks out refs/remotes/acehack/main, but this form can leave refs/remotes/acehack/main stale because the command-line refspec updates FETCH_HEAD while remote-tracking updates still depend on remote.acehack.fetch mapping. In repos with narrowed/custom fetch refspecs, the next git switch --detach refs/remotes/acehack/main can branch from an old commit, recreating the wrong-base-state failure this memo is trying to prevent.
Useful? React with 👍 / 👎.
| # Create the local tracking branch unconditionally at the | ||
| # explicit ref (-f forces update if it already exists; | ||
| # explicit start-point removes any guessing): | ||
| git branch -f main refs/remotes/origin/main |
There was a problem hiding this comment.
Guard
git branch -f main when main is checked out
This sequence is described as creating/updating local main “unconditionally”, but git branch -f main ... fails with fatal: cannot force update the branch 'main' used by worktree when the current branch is already main. In automation that uses set -e, that aborts the flow before the subsequent git switch main, so the documented recovery path is brittle for a common starting state.
Useful? React with 👍 / 👎.
| git fetch origin refs/heads/main:refs/remotes/origin/main --quiet | ||
| # Create the local tracking branch unconditionally at the | ||
| # explicit ref (-f forces update if it already exists; | ||
| # explicit start-point removes any guessing): | ||
| git branch -f main refs/remotes/origin/main | ||
| # Now bare `git switch main` is safe because refs/heads/main | ||
| # exists locally and matches first in Git's lookup order: | ||
| git switch main || { echo "failed to switch to local main"; exit 1; } | ||
| git reset --hard refs/remotes/origin/main |
There was a problem hiding this comment.
In the "local main branch tracking origin" snippet, the earlier section emphasizes hard-stopping on base-ref setup failures, but this snippet doesn’t enable strict mode (set -euo pipefail) or otherwise check git fetch / git branch -f for failure. As written, a failed fetch/update could still allow the script to continue on a stale base ref. Consider either adding strict mode at the top of this snippet or adding explicit || exit checks (and/or a note that the snippet assumes strict mode is already enabled).
| **Branch off AceHack main**: | ||
|
|
||
| ```bash | ||
| git fetch acehack main --quiet |
There was a problem hiding this comment.
The AceHack example fetches main but then detaches from refs/remotes/acehack/main. Depending on the remote’s fetch refspec configuration, git fetch acehack main may only update FETCH_HEAD and leave refs/remotes/acehack/main stale, which would defeat the “explicit base ref” goal. Consider using an explicit refspec here as well (mirroring the origin example) so refs/remotes/acehack/main is guaranteed to be refreshed before switching.
| git fetch acehack main --quiet | |
| git fetch acehack refs/heads/main:refs/remotes/acehack/main --quiet |
…d + bare-main round-4 fix) (#785) PR #783 merged. PR #775 round-4 fix: Codex P1 caught my round-3 overcorrection ('git switch refs/heads/main' is invalid for non-detached mode). Reverted to bare 'git switch main' AFTER ensuring local ref exists via 'git branch -f main ...'. 24 PRs total this session arc. New recurring-fix-class meta-entry: agent-overcorrection-thread (a fix from earlier itself becomes the bug in a later finding). Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
… (26 PRs total session arc) (#787) PR #775 squash-merged at 05:19:23Z after 4 rounds of refinement (Amara initial + multi-AI synthesis packet + Codex P2 + Codex P1 catching my round-3 overcorrection). 26 PRs total this session arc. Best keeper: 'Topology is allowed. Ambiguity is expected. Continuing after fatal ambiguity is forbidden.' Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Amara caught (via the autonomous-loop trace) that scripts were repeatedly hitting
fatal: main matched multiple (2) remote tracking branchesand continuing as if successful — producing wrong downstream working-tree state.New durable memory file: generic rule applies to ANY repo with multiple remotes that have
main(not just Zeta's LFG ↔ AceHack setup, since future-Claude might be dropped into recovery on a different multi-remote repo).Best line: "Bare
mainis for humans. Automation uses explicit refs."🤖 Generated with Claude Code