Skip to content

feat(assistant): record withheld topics and reopen closed topics on material change - #6368

Merged
liugddx merged 2 commits into
mainfrom
feat/6359-topic-disposition
Oct 27, 2026
Merged

liugddx merged 2 commits into
mainfrom
feat/6359-topic-disposition

Conversation

@liugddx

@liugddx liugddx commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Implements the remaining gap in #6359 (decision 5 of #6247). Investigated (notes), told (delivery receipts) and the user's open/deferred/closed policy already existed. Two things were missing, and the maintainer chose how to settle them: a model judges whether information materially changed, and "withheld" is stored separately.

Judgement drafts may now carry two optional arrays:

  • withheld: a topic investigated but not told, with a reason. Stored apart from notes and receipts. It does not mark the topic as sent and is not a ban on discussing it later.
  • reopened: a closed or deferred topic whose information materially changed. The change must be in the notebook: a note on that topic recorded after the user feedback that governs it. The model cannot reopen on assertion alone. A newer user rule overrides a reopening. Only a topic the user closed or deferred can be reopened.

The prompt contract, the notebook view the model reads, and the README describe both. Exploration still only appends notes. The README sentence "only genuine user feedback may close, defer or reopen a topic" now says reopen is also possible on changed information.

Fixes #6359
Refs #6247, #6309

Verification

Node 24.21.0, origin/main@0993b381a:

Check Result
npm run test:assistant 93 + 96 + 88 pass, 0 fail
The same suite with the old notebook.ts 7 of the 7 new tests fail, the rest pass
tsc -b packages/runtime-host, biome check, npm run check:asf-headers pass

New tests: withheld is stored apart from told and is visible to the model; withheld needs a known topic and a reason and only judgement can write it; a rejected topic with no change is not reopened; a material change reopens a closed topic and the view says why; a newer user rule beats an earlier reopening; only user-closed or deferred topics can be reopened; a deferred topic can be reopened early.

Not run: a real model against the new prompt wording, Node 22, Windows, the rest of the workspace suite.

Review focus

  • Whether requiring a note after the user's feedback is the right evidence bar for "material change". It keeps the decision auditable but means the model must append the change before reopening.
  • The prompt wording for withheld and reopened has only been checked structurally, not against live model output. test(assistant): evaluate discovery for missed discoveries as well as repeats #6360 adds the evaluation that can measure it.

Behaviour change

Yes: judgement can now reopen a closed or deferred topic. Existing drafts without the new arrays behave as before.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code (Claude Opus 5.5) wrote the change and tests. I reviewed the diff and ran the checks above. The commit carries a Generated-by trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

🤖 Generated with Claude Code

…aterial change

Discovery kept "investigated" (notes), "told" (delivery receipts) and the
user's open/deferred/closed policy, but had no record of a topic the judgement
looked into and chose not to tell the user, and a closed topic stayed closed
until the user said otherwise.

Judgement drafts may now carry two optional arrays:
- withheld: a topic investigated but not told, with a reason. Stored apart from
  notes and receipts; it does not mark the topic as sent and is not a ban.
- reopened: a closed or deferred topic whose information materially changed.
  The change must be in the notebook, as a note on that topic recorded after the
  governing user feedback, so the model cannot reopen on assertion alone. A newer
  user rule overrides a reopening.

The prompt contract, the notebook view the model reads, and the README describe
both. Exploration still only appends notes.

Fixes #6359
Refs #6247

Generated-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@liugddx liugddx self-assigned this Oct 27, 2026
@github-actions github-actions Bot added the effort/M Under 500 readable lines label Oct 27, 2026

@me2seeks me2seeks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Found one reproducible policy-precedence bug when a topic acquires a tag after it was reopened. The 7 added disposition tests pass, but an additional real Notebook regression reproduces the issue below.

… against

A reopening was applied whenever it was recorded after the governing user
feedback. Topics gain tags over time, so the rule that governs a topic can
change with no new feedback event: a newer rule on a tag starts to match once
the topic acquires that tag. The earlier reopening then overrode a user rule
the model had never judged a change against.

Store the governing feedback id and rule index in the reopening and apply it
only while that same rule still governs. The topic can be reopened again, but
only by a judgement against the rule that governs now.

Refs #6359

Generated-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@liugddx

liugddx commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Thanks @me2seeks, reproduced and fixed.

The reopening was applied whenever it was recorded after the governing feedback, but topics() accumulates tags, so the governing rule can change with no new feedback event. Each reopening now stores the governing feedback id and rule index, and state() applies it only while that same rule still governs. The topic can be reopened again, but only by a judgement against the rule that governs now.

Your scenario is a regression test: close tea (f1), close tag sport (f2), reopen tea against f1, then add a sport-tagged tea note. Tea is closed by f2, and a fresh reopening reopens it. It fails without the fix. test:assistant passes (93 + 97 + 88) on Node 24.21.0.

@me2seeks me2seeks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed the updated head. Reopenings are now bound to the feedback rule they were judged against, and the added tag-change regression covers the previous finding. Local assistant suites pass (93 + 97 + 88); hosted CI is green and the review thread is resolved.

@liugddx
liugddx merged commit 112883c into main Oct 27, 2026
1 check passed
@liugddx
liugddx deleted the feat/6359-topic-disposition branch October 27, 2026 09:55
ggbdpq added a commit to ggbdpq/maka that referenced this pull request Nov 24, 2026
Two gaps in the notebook initiative, both from apache#6368:

- commitDraft resolved user feedback (writing closed/deferred rules) before
  processing `reopened`, and reopenTopic only compares event seqs. A judgement
  draft could close a topic and reopen it in the same commit: notes appended
  earlier in that draft always postdate the governing feedback, so the "note
  recorded after the user feedback" guard passed against the very rule the
  draft itself had just written, overriding the user's fresh decision. The
  reopened pass now rejects a reopening whose governing rule was interpreted
  in the same draft; reopens judged against rules from earlier wakes are
  unchanged, and a rejected draft still rolls back atomically.
- NOTEBOOK_RULES still said only explicit user feedback may reopen a topic,
  contradicting the wakeInput contract and the README, which scope reopenings
  to a material change recorded in the notebook. The rules now match that
  contract; the prompt-version hash covers NOTEBOOK_RULES, so existing worker
  Sessions receive the corrected text on their next wake.

Fixes apache#6388

Generated-by: GLM-5.3-Flash (ZCode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(assistant): remember user disposition of discovery topics

2 participants