diff --git a/context-restore/SKILL.md b/context-restore/SKILL.md index f937eefb7..2cfcc402f 100644 --- a/context-restore/SKILL.md +++ b/context-restore/SKILL.md @@ -560,8 +560,8 @@ fi under **Verify first**: the saving session could not know about those commits, so any step may already be done. - `HEAD_DIVERGED` or `HEAD_UNKNOWN`: print `This checkpoint was saved at {first 7 - characters of head}, which is not in this checkout's history (rebased, reset, or - not fetched).` and list every item under Verify first. + characters of head}, which is not in this checkout's history (saved on another + branch, rebased, reset, or not fetched).` and list every item under Verify first. - `HEAD_UNTRACKED`: print `This checkpoint predates commit tracking; restore cannot tell whether work landed after it.` and sort as usual. diff --git a/context-restore/SKILL.md.tmpl b/context-restore/SKILL.md.tmpl index 4c5f2dd1d..0f4d974ec 100644 --- a/context-restore/SKILL.md.tmpl +++ b/context-restore/SKILL.md.tmpl @@ -236,8 +236,8 @@ fi under **Verify first**: the saving session could not know about those commits, so any step may already be done. - `HEAD_DIVERGED` or `HEAD_UNKNOWN`: print `This checkpoint was saved at {first 7 - characters of head}, which is not in this checkout's history (rebased, reset, or - not fetched).` and list every item under Verify first. + characters of head}, which is not in this checkout's history (saved on another + branch, rebased, reset, or not fetched).` and list every item under Verify first. - `HEAD_UNTRACKED`: print `This checkpoint predates commit tracking; restore cannot tell whether work landed after it.` and sort as usual. diff --git a/test/context-restore-head.test.ts b/test/context-restore-head.test.ts index 8e855e786..7365cb039 100644 --- a/test/context-restore-head.test.ts +++ b/test/context-restore-head.test.ts @@ -144,6 +144,18 @@ describe('context-restore compares the checkpoint with HEAD', () => { expect(headCheck(app, file)).toStartWith('HEAD_DIVERGED '); }); + test('a checkpoint resumed from another branch is reported, and the prompt names that cause', () => { + const app = repo(); + git(app, 'checkout', '-q', '-b', 'feature'); + commit(app, 'feature work'); + const file = save(app); + git(app, 'checkout', '-q', 'main'); + commit(app, 'unrelated main work'); + expect(headCheck(app, file)).toStartWith('HEAD_DIVERGED '); + const restore = fs.readFileSync(path.join(ROOT, 'context-restore/SKILL.md'), 'utf-8'); + expect(restore).toContain('(saved on another\n branch, rebased, reset, or not fetched)'); + }); + test('checkpoints saved before head tracking, or with a malformed head, are never treated as current', () => { const app = repo(); const legacy = path.join(tmp, 'legacy.md');