You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR head branch: chore/empty-randomass-20260617215922
Daemon log repeatedly reported:
scm observer: no PR detected for branch session=ao-agents-10 branch=ao/ao-agents-10 err="scm: not found: no open PR for branch ao/ao-agents-10"
The PR existed and was open, but the observer did not attribute it to the session because the head branch did not equal or descend from the stored session branch.
Manual recovery worked:
ao session claim-pr ao-agents-10 296 --json
That attached PR #296 to the session successfully.
Why this matters
Agents or humans working inside a managed session can create a new branch manually before opening a PR. In that case, AO's branch-prefix discovery misses the PR even though it was created from the session's worktree. The dashboard then shows no PR until someone manually claims it.
Current behavior
The SCM observer detects PRs by matching open PR source branches to each live session's stored branch:
exact match: sourceBranch == sessionBranch
stacked match: sourceBranch starts with sessionBranch + "/"
This is generally correct for AO-created branches, but fails when the live worktree branch has changed and the session row was not updated.
Expected behavior
AO should either:
keep the session's stored branch synchronized when a managed session changes branches, or
detect/claim PRs created from the session's current worktree branch even if it differs from the original stored branch, or
surface an actionable warning/recovery path when a PR exists on the current worktree branch but cannot be attributed.
Possible fix directions
Ensure the git wrapper or hook path updates the Go daemon's durable sessions.branch, not just legacy metadata files.
During SCM observation, optionally compare the current worktree branch for live sessions against the stored branch and refresh it when safe.
Add a CLI/UI hint when GET /sessions/{id}/pr is empty but the current checked-out branch has an open PR.
Consider having gh pr create wrapper call the daemon claim-pr endpoint directly when AO_SESSION_ID is available.
Problem
AO can miss a PR created by a managed session when the PR head branch does not match the session's stored branch.
Observed with session
ao-agents-10:~/.ao/data/ao.db:ao/ao-agents-10chore/empty-randomass-20260617215922The PR existed and was open, but the observer did not attribute it to the session because the head branch did not equal or descend from the stored session branch.
Manual recovery worked:
That attached PR #296 to the session successfully.
Why this matters
Agents or humans working inside a managed session can create a new branch manually before opening a PR. In that case, AO's branch-prefix discovery misses the PR even though it was created from the session's worktree. The dashboard then shows no PR until someone manually claims it.
Current behavior
The SCM observer detects PRs by matching open PR source branches to each live session's stored branch:
sourceBranch == sessionBranchsourceBranchstarts withsessionBranch + "/"This is generally correct for AO-created branches, but fails when the live worktree branch has changed and the session row was not updated.
Expected behavior
AO should either:
Possible fix directions
gitwrapper or hook path updates the Go daemon's durablesessions.branch, not just legacy metadata files.GET /sessions/{id}/pris empty but the current checked-out branch has an open PR.gh pr createwrapper call the daemonclaim-prendpoint directly whenAO_SESSION_IDis available.Supporting evidence
sessionsrow showed:PR #296 showed:
{ "number": 296, "state": "OPEN", "headRefName": "chore/empty-randomass-20260617215922", "baseRefName": "main", "isDraft": false }Manual claim response:
{ "ok": true, "sessionId": "ao-agents-10", "prs": [ { "url": "https://github.com/aoagents/ReverbCode/pull/296", "number": 296, "state": "open", "ci": "passing", "review": "none", "mergeability": "mergeable", "reviewComments": false } ], "branchChanged": false, "takenOverFrom": [] }