Bug
AO tells worker sessions to create PR branches under their session branch namespace, for example ao/agent-orchestrator-7/fix-terminal-clipboard-305, but the session root branch itself is created as ao/agent-orchestrator-7. Git stores branch refs path-like, so an existing refs/heads/ao/agent-orchestrator-7 prevents creating refs/heads/ao/agent-orchestrator-7/<topic>.
Observed in session agent-orchestrator-7: the agent attempted:
git checkout -b ao/agent-orchestrator-7/fix-terminal-clipboard-305
Git failed with:
fatal: cannot lock ref 'refs/heads/ao/agent-orchestrator-7/fix-terminal-clipboard-305': 'refs/heads/ao/agent-orchestrator-7' exists; cannot create 'refs/heads/ao/agent-orchestrator-7/fix-terminal-clipboard-305'
The agent then fell back to fix-terminal-clipboard-305, opened PR #306 from that branch, and AO did not attach PR facts to the session because the SCM observer only attributes PRs whose source branch equals the stored session branch or has it as a / child prefix.
Analyzed against: local main checkout on 2026-06-18
Confidence: High
Reproduction
- Spawn a worker session whose default branch is
ao/<session-id>.
- From that worktree, try to create
ao/<session-id>/<topic>.
- Git rejects the child branch because
refs/heads/ao/<session-id> already exists.
- If the agent creates a fallback branch outside the namespace and opens a PR, AO's observer does not attribute the PR to the session.
Root Cause
- Worker branch defaults to
ao/<session-id> in backend/internal/session_manager/manager.go.
- Worker instructions ask agents to use
<session-branch>/<topic> for additional PRs.
- Git cannot have both
refs/heads/ao/<session-id> and refs/heads/ao/<session-id>/<topic>.
- PR discovery in
backend/internal/observe/scm/observer.go relies on exact or slash-child source branch matching, so fallback branches outside the namespace remain untracked.
Fix
The fix helps by making AO's branch convention valid in Git and matching AO's PR discovery logic.
Before:
session branch: ao/agent-orchestrator-7
expected child PR branch: ao/agent-orchestrator-7/fix-terminal-clipboard-305
Git rejects that because refs/heads/ao/agent-orchestrator-7 already exists, so it cannot also create refs/heads/ao/agent-orchestrator-7/fix-terminal-clipboard-305.
After:
session branch: ao/agent-orchestrator-7/root
sibling PR branch: ao/agent-orchestrator-7/fix-terminal-clipboard-305
Now Git can store both branches:
refs/heads/ao/agent-orchestrator-7/root
refs/heads/ao/agent-orchestrator-7/fix-terminal-clipboard-305
AO also treats the parent namespace ao/agent-orchestrator-7 as owned by the session, so GitHub PR heads under that namespace are attributed back to agent-orchestrator-7.
Impact
- Worker sessions can create PRs successfully but AO may not discover or display them.
- Summary/activity tabs drift because PR facts are never inserted into SQLite.
- Agents following AO's own prompt hit a Git ref layout error.
Bug
AO tells worker sessions to create PR branches under their session branch namespace, for example
ao/agent-orchestrator-7/fix-terminal-clipboard-305, but the session root branch itself is created asao/agent-orchestrator-7. Git stores branch refs path-like, so an existingrefs/heads/ao/agent-orchestrator-7prevents creatingrefs/heads/ao/agent-orchestrator-7/<topic>.Observed in session
agent-orchestrator-7: the agent attempted:Git failed with:
The agent then fell back to
fix-terminal-clipboard-305, opened PR #306 from that branch, and AO did not attach PR facts to the session because the SCM observer only attributes PRs whose source branch equals the stored session branch or has it as a/child prefix.Analyzed against: local main checkout on 2026-06-18
Confidence: High
Reproduction
ao/<session-id>.ao/<session-id>/<topic>.refs/heads/ao/<session-id>already exists.Root Cause
ao/<session-id>inbackend/internal/session_manager/manager.go.<session-branch>/<topic>for additional PRs.refs/heads/ao/<session-id>andrefs/heads/ao/<session-id>/<topic>.backend/internal/observe/scm/observer.gorelies on exact or slash-child source branch matching, so fallback branches outside the namespace remain untracked.Fix
The fix helps by making AO's branch convention valid in Git and matching AO's PR discovery logic.
Before:
Git rejects that because
refs/heads/ao/agent-orchestrator-7already exists, so it cannot also createrefs/heads/ao/agent-orchestrator-7/fix-terminal-clipboard-305.After:
Now Git can store both branches:
AO also treats the parent namespace
ao/agent-orchestrator-7as owned by the session, so GitHub PR heads under that namespace are attributed back toagent-orchestrator-7.Impact