Skip to content

fix(decisions): gate memory.recall on an open owner dashboard - #32076

Merged
bolichen97 merged 1 commit into
mainfrom
fix/12532-recall-owner-viewer
Nov 7, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/12532-recall-owner-viewer

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Jev only judges a memory_recall result while the owner actually has the dashboard open, so recalled memory is never sent for a restored tab nobody is looking at.

After a gateway restart, the restored chat tabs count as "open in the dashboard" before any browser connects, and they keep counting after the last browser closes. If the agent in one of those tabs calls memory_recall, the memory.recall decision point sends snippets of the recalled memories to the decision provider and stamps a receipt on a reply that nobody is there to read.

Why it matters

The memory.recall gate exists so recalled memory leaves the machine only when the owner is reading that conversation. Owners who consented to recalled-memory egress get egress on conversations they are not watching: every boot with restored tabs, and every time the browser is closed while a tab stays open.

Not a goal

What changed (motivation → approach → change)

Symptom: a recall in a restored tab is judged with no dashboard connected. Root cause: the gate in dashboard/handlers/memory_member.py reads only session_surface.dashboard_surfaced_keys(), which boot fills from the restored slot table before any browser connects. That set tracks tabs, not viewers.

The gate now also needs an open owner dashboard socket (_owner_dashboard_open: one of state._owner_ws_clients that is not closed). The check lives in the same predicate, so the early refusal and the still_watched read just before the egress both apply it. A recall with no owner dashboard open returns the full similarity result, the same answer a cron or sub-agent recall already gets. The decisions spec (docs/system-specs/modules/decisions.md section 13) and the point's contract in decisions/points/memory_recall.py state the rule.

Backwards compatibility

Compatible: the recall route answers the same way in every case; the only difference is that Jev is not asked when no owner dashboard socket is open, and that case returns the unnarrowed result, which is what every refused decision already returns.

Removes nothing: no route, field, key or stored row changes; the decision is skipped in one more case and its fallback is the existing one.

Tests

  • test_a_published_slot_with_no_dashboard_open_is_not_decided_for: a session that is in the published set with no owner socket registered (the boot state) sends nothing to the provider, writes no decision row, and gets the whole similarity result back; the same session with an open owner socket is decided for.
  • test_a_tab_closed_during_the_search_sends_nothing runs twice: closing the tab mid-search, and closing the owner's last dashboard socket mid-search while it stays registered. Both send nothing, which pins the read at the egress, not only the early refusal.
  • The file's _request helper puts one open owner socket on the state by default, so every other test in test/test_decisions_memory_recall_reachable.py keeps exercising the decided path.

Proof: PROVEN test/test_decisions_memory_recall_reachable.py::TestOnlyACommittedRecallLeavesAReceipt::test_a_tab_closed_during_the_search_sends_nothing[dashboard], test/test_decisions_memory_recall_reachable.py::TestTheGatesStillHold::test_a_published_slot_with_no_dashboard_open_is_not_decided_for (head d788b2a)

Determinism: the whole file passed 10 runs at -n0, 5 runs at -n 4 --dist loadgroup --max-worker-restart=2 beside test_decisions_memory_recall.py and test_decisions_memory_recall_apply.py, and one shuffled run (seed 5207). The new and changed tests use a temp store and an in-process fake provider, with no sleep or clock wait.

Manual verification

N/A - unit coverage sufficient: the test drives the real recall route, decision gate, consent and decision log with only the provider transport faked.

Related Issues

Part of #12532

Sibling sweep

Swept: git grep -n "dashboard_surfaced_keys\|has_dashboard_surface" -- src/kiro_crew/
Sibling: src/kiro_crew/dashboard/handlers/memory_member.py:139 -- changed here
Sibling: src/kiro_crew/directive_origin.py:27 -- not affected -- it asks whether a session could show a card, and sends nothing off the machine
Sibling: src/kiro_crew/dashboard/session_directive_apply.py:176 -- not affected -- it decides where a directive card renders; a browser that connects later reads it from the slot

Pattern harvest

Not generalizable: the published surfaced set is read as an egress gate in one place only, and every other reader asks a capability question that the slot table answers correctly.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 7, 2026 04:01
@bolichen97
bolichen97 enabled auto-merge (squash) November 7, 2026 04:14
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 7, 2026
@bolichen97
bolichen97 force-pushed the fix/12532-recall-owner-viewer branch from 72d0240 to d788b2a Compare November 7, 2026 07:12
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of d3465a942ec06612c4140ea1680d7d6bc5bd6d9d and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d3465a9

False positive or not applicable? A repository writer can comment:
/ai-review override gpt d3465a942ec06612c4140ea1680d7d6bc5bd6d9d false-positive: <reason, 20 to 500 characters>

@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/decisions.md since this head went green (e6524c8 -> eaf86e9); CI re-running.

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision d3465a942ec06612c4140ea1680d7d6bc5bd6d9d touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of d3465a942ec06612c4140ea1680d7d6bc5bd6d9d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the change narrows one egress gate, fails closed, takes nothing away, and is easy to revert.

Notes

  • still_watched runs on the executor thread, where list(state._owner_ws_clients) copies a set that the event loop changes. If the set changes size during the copy it raises RuntimeError, so make sure the point treats an exception from the predicate as "not watched".

[DESIGN-REVIEWED] d3465a9

Description read

[DESCRIPTION-READ] 8da3dc5ce683ac02dd4b9246dfd6eac52c866d00b37505d38100d587a8c9d6ec

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of d3465a942ec06612c4140ea1680d7d6bc5bd6d9d — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. This is a mechanism-level fix to the memory.recall egress gate, and the defect is shown by a new test that fails on base.

What this change ships

Inventory (4 items) — 4 justified

Intent: the owner wants recalled memory to leave the machine only while they are actually viewing the dashboard. This is a FIX.

  1. A recall in a restored tab with no owner dashboard open is no longer sent to the decision provider and gets the full result back — justified
  2. Closing the last owner dashboard during a search also stops the egress — justified
  3. The decisions spec §13 and the memory_recall point contract now state the socket condition — justified
  4. _memory_recall_keep now takes state, and its one caller passes it — justified

[FIRST-PRINCIPLES-REVIEWED] d3465a9

Description read

[DESCRIPTION-READ] 264983615ec7f35b3f77ebdf7139c28bbf79f98e861822dd9b2d693f44645d75

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed d3465a942ec06612c4140ea1680d7d6bc5bd6d9d — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] d3465a9

Verdict parsed from the review's SHA-scoped output markers for commit d3465a942ec06612c4140ea1680d7d6bc5bd6d9d.

False positive or not applicable? A repository writer can comment:
/ai-review override fable d3465a942ec06612c4140ea1680d7d6bc5bd6d9d false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 7, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] The red Backend Tests shard 2 (Linux and Windows) and the Coverage Gate on d788b2a come from main, not this change: test/test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget fails on origin/main 0795ebc too (the security package is 34,855 lines against a 34,845 budget), and this PR touches nothing in that package. #32183 raises the budget; this PR re-syncs onto main once that merges.

Boot restores slots and publishes their keys to the dashboard-surfaced
set before any browser connects, and they stay published after the
last one closes. The memory.recall gate read only that set, so a recall
in a restored tab could send recalled memory to the decision provider
with nobody there to read the receipt.

The gate now also needs an open owner dashboard socket, read in the
same predicate at the early refusal and at the egress.

Part of #12532
@bolichen97
bolichen97 force-pushed the fix/12532-recall-owner-viewer branch from d788b2a to d3465a9 Compare November 7, 2026 13:43
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/, src/kiro_crew/dashboard/handlers/, src/kiro_crew/decisions/ and test/ (including test/test_security_gate_liveness.py, whose package line budget main has since raised) since this head went green (b764e20 -> f58c3cf); CI re-running.

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 7, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: PR Readiness passed on d3465a9, and all five review lanes (Opus 5.5, GPT 6.1, Design, UX, First Principles) report no blocking finding on this head. No conflict and no open change request.

@bolichen97
bolichen97 merged commit c2d3166 into main Nov 7, 2026
99 checks passed
@bolichen97
bolichen97 deleted the fix/12532-recall-owner-viewer branch November 7, 2026 19:47
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
bolichen97 added a commit that referenced this pull request Nov 9, 2026
Boot restores slots and publishes their keys to the dashboard-surfaced
set before any browser connects, and they stay published after the
last one closes. The memory.recall gate read only that set, so a recall
in a restored tab could send recalled memory to the decision provider
with nobody there to read the receipt.

The gate now also needs an open owner dashboard socket, read in the
same predicate at the early refusal and at the egress.

Part of #12532

(cherry picked from commit c2d3166)

Backport note: the recall call keeps release's arguments (no
conversation_id, feat #30968) and gains the state argument. The
memory_recall.py docstring and the tab-closed test's docstring keep
release's wording with the open owner dashboard added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants