fix(8321): a .grimoire marker that disagrees with the repo's binding is named at session start
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / Python lint (push) Successful in 2s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Failing after 1m58s
CI & Build / integration (push) Successful in 1m58s
CI & Build / Build & push image (push) Skipped

A marker copied along with a repo outlived the project it was written for:
the Throne folder's marker still named project 38 after the split, so every
hook held the session to Cartographer and writes to Throne stopped on the
project fence, with nothing saying why.

The SessionStart hook now sends the remote beside a marker's project_id. The
marker still decides the project; /context also resolves the remote's binding,
and when it names a different project the context says which project each
names and how to fix the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 13:22:50 -05:00
co-authored by Claude Opus 5.5
parent 9de0e80531
commit f4d6486255
6 changed files with 113 additions and 3 deletions
+9 -1
View File
@@ -116,16 +116,24 @@ async def session_context():
send it when a `.grimoire` marker file names a project. Takes
precedence over `repo`. Access-checked like any other read — an id
this account cannot read loads no project rather than failing.
Sent with `repo`, the remote's binding is still looked up, and a
binding to a different project is reported in the context.
source (optional str) — the host's SessionStart source (startup,
resume, compact, clear, fork); decides what the claim section says.
session_id (optional str) — the session's id, so a claim bound to it
reads as this session's own.
"""
project_id, _repo, unbound_repo = await _project_scope()
project_id, repo, unbound_repo = await _project_scope()
# A marker named the project and the hook sent the remote beside it: look
# the remote up too, so a disagreement between the two can be said.
repo_project_id = 0
if project_id and repo:
repo_project_id = await repo_bindings_svc.resolve_project(g.user.id, repo) or 0
result = await plugin_ctx_svc.build_session_context(
g.user.id, project_id, unbound_repo=unbound_repo,
source=(request.args.get("source") or "").strip()[:20],
session_id=(request.args.get("session_id") or "").strip()[:200],
repo_project_id=repo_project_id,
)
return jsonify(result)