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
{{ message }}
Repository navigation
context-refresh --once and charter_context serve a stale snapshot as fresh after a branch, HEAD or working-tree change #440
shouldSkipRefresh (context-refresh.ts:431) compares only generatedAt against the TTL. loadCharterContextSnapshot (serve.ts:656) returns the file as-is. After a branch switch, a new commit, or an edited file, the hook reports fresh_snapshot and MCP charter_context serves the old branch and dirty state with no staleness signal.
A resuming agent, the exact case this surface exists for, gets a wrong answer stated with confidence, while git status is right in one call.
Reproduction (pinned 5412100; both reviewers reproduced it independently)
charter context-refresh --sources git # snapshot on main, clean
git checkout -b scratch/x HEAD~5; echo "// wip" >> some/file.ts
charter context-refresh --once --format json # "status":"skipped","reason":"fresh_snapshot"
# .ai/context.snapshot.json still shows the old branch, dirty:false, the old top commit
Expected
--once skips only when the stored git fingerprint (branch, full HEAD SHA, dirty-file set) matches the live repo. Expensive non-git sources may keep the TTL.
charter_context (and the snapshot JSON) adds stale: boolean and staleReasons: string[]. Additive fields only; existing keys unchanged.
Snapshot stores the full HEAD SHA.
Generated snapshot and telemetry files don't count as dirty, so refreshing never invalidates itself.
Acceptance (one TTL window, one test each)
Branch switch at the same SHA, a commit on the same branch, a dirty-file edit: each refreshes, or reports stale:true with a reason. An unchanged repo still takes the cheap skip path.
Works on its own. Part of #437 (the preflight freshness stamp depends on it).
Activity
feat(cli): preflight answer, first slice (#447) (#455)
fix(cli): ignore cwd/--config telemetry and repo-intel in snapshot fi…
fix(cli): snapshot freshness fingerprint for context-refresh --once a…
feat(cli): fill Contract, Run first and Fresh in the preflight answer (…