fix(fence): the cross-project permission prompt says what changes and where first, in plain words
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 15s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Successful in 2m2s
CI & Build / integration (push) Successful in 2m40s
CI & Build / Build & push image (push) Successful in 25s

The first line names the act and the project it lands in against the one the
session works in; the second says when to approve; the agent's issue-filing
call moves to a last line in parentheses. Tool names are spelled out and
project ids dropped from the operator's text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 09:56:19 -05:00
co-authored by Claude Opus 5.5
parent 2903b090a1
commit 706f49a12a
2 changed files with 32 additions and 16 deletions
+25 -10
View File
@@ -303,8 +303,21 @@ async def _titles(ids: list[int]) -> dict[int, str]:
def _named(project_id: int, titles: dict[int, str]) -> str:
title = titles.get(project_id)
return f"{title} (project {project_id})" if title else f"project {project_id}"
return titles.get(project_id) or f"project {project_id}"
def _doing(tool: str, act: str) -> str:
"""The act in words a person reads at a glance: "Retire family idea",
"git push", "Editing a file". A tool name is spelled out, not quoted."""
act = act.strip()
if act.endswith(" in"):
act = act[:-3]
if act:
return act[:1].upper() + act[1:]
if tool:
words = tool.replace("_", " ").strip()
return words[:1].upper() + words[1:]
return "This change"
async def check_act(
@@ -343,22 +356,24 @@ async def check_act(
targets = [{"id": p, "title": titles.get(p, "")} for p in others]
if tool and is_issue_filing(tool, args):
return {"allowed": True, "targets": targets, "issue": True, "reason": ""}
# The reason is the permission prompt's text: the operator reads it
# first, so it leads with what changes and where, then when to approve.
# The session reads it after a "no", so the last line is for the agent.
there = ", ".join(_named(p, titles) for p in others)
home = _named(session_project, titles)
if tool in RULE_CURATION_TOOLS:
rules = sorted({r for name in _RULE_ARGS for r in _positive_ints(args.get(name))})
which = ", ".join(f"rule {r}" for r in rules) or "a rule"
reason = (
f"This session belongs to {_named(session_project, titles)}. {tool} changes "
f"{which} of {there}, a different project. Rules are the operator's to "
f"curate from any session: approve if they asked for this change."
f"Changing {which} in {there}, but this session is working in {home}.\n"
"Rules are yours to curate from any session. Approve if you asked for this change."
)
return {"allowed": False, "targets": targets, "issue": False, "reason": reason}
what = act.strip() or (f"{tool} changes" if tool else "This changes")
first = others[0]
reason = (
f"This session belongs to {_named(session_project, titles)}. {what} {there}, "
f"a different project. From here, the one change to make there is filing an "
f"issue: create_task(project_id={first}, kind=\"issue\") with how it was found "
f"and the evidence. Approve only if this session should change {there} itself."
f"{_doing(tool, act)} in {there}, but this session is working in {home}.\n"
f"Approve only if you asked for this change to {there}.\n"
f"(If not: the agent can report it there instead, with "
f"create_task(project_id={first}, kind=\"issue\").)"
)
return {"allowed": False, "targets": targets, "issue": False, "reason": reason}