feat(8815): a message that reads as another project's work asks the session to check before acting
CI & Build / TypeScript typecheck (push) Successful in 10s
CI & Build / Python lint (push) Successful in 1s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / Python tests (push) Successful in 1m55s
CI & Build / integration (push) Successful in 2m57s
CI & Build / Build & push image (push) Successful in 35s

An operator running one session per project can type into the wrong
window, and nothing caught it: the message usually asks for work the
session can do in its own repo, so the project fence never fires.

The prompt lookup (/api/plugin/retrieve) now ranks the operator's own
words against every project's records (services/project_check.py). When
another project's records clearly win (best match >= 0.78, ahead of this
project's by 0.05, with at least 3 of the 12 nearest), a line leads the
payload, ahead of every rule, telling the session to ask the operator
whether the message was meant for it. Naming the other project halves the
margin but never flags alone; naming this project rules a flag out. A
message with no subject, or a session with no project, is not checked.

Each flag is a new `project_check` gate stop with both scores, asked once
per session per other project, read back in retrieval_telemetry's gates
block and in the web UI's gate readout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-05 22:21:49 -05:00
co-authored by Claude Opus 5.5
parent 72ef1bb45d
commit 58991038d8
8 changed files with 386 additions and 5 deletions
+15
View File
@@ -24,6 +24,7 @@ const GATES: [GateName, string][] = [
["checkpoint", "Command checkpoint"],
["fence", "Project fence"],
["reply", "Reply held for a read"],
["project_check", "Message meant for another project?"],
];
const any = computed(() =>
@@ -32,6 +33,8 @@ const any = computed(() =>
function gateText(gate: GateName, c: GateCounts): string[] {
if (gate === "fence") return [`asked ${c.stops}`, `approved ${c.ran}`];
// The session is told to check with the operator; nothing is stopped.
if (gate === "project_check") return [`asked ${c.stops}`];
const parts = [`stopped ${c.stops}`, `cleared by a read ${c.cleared}`, `misfired ${c.misfired}`];
// An enforced refusal has no cap, and the reply's cap is applied by the
// server before anything holds, so neither can let a call through.
@@ -101,6 +104,18 @@ function gateText(gate: GateName, c: GateCounts): string[] {
</li>
</ul>
</details>
<details v-if="data.project_check?.length" class="gate-detail">
<summary>Messages that read as another project's</summary>
<ul class="gate-list">
<li v-for="p in data.project_check" :key="`${p.target}`" class="gate-row">
<span class="gate-title">project {{ p.target }}</span>
<span class="gate-counts">
<span>asked {{ p.asks }}</span>
<span v-if="p.last_asked_at" class="stat-when">last {{ fmtDate(p.last_asked_at) }}</span>
</span>
</li>
</ul>
</details>
</template>
</section>
</template>