Skip to content

bug(assistant): a judgement draft can close and reopen a topic in the same wake, overriding the user decision — and the notebook prompt still describes the old reopen rule #6388

Open

Description

@ggbdpq

What happened

Two related gaps in the notebook topic lifecycle introduced by #6368:

1. A reopen in the same draft as the close overrides the user's just-expressed decision — and the message goes out in the same wake. commitDraft processes feedbackDecisions (writing closed rules) before reopened (notebook.ts:369-381), and reopenTopic's guards pass on freshly-written state: the topic is closed ✓ and the draft's own note has a larger seq than the governing feedback ✓. So a judgement draft that contains feedbackDecisions: [close X], a note on X, reopened: [X], and messages: [about X] atomically closes, reopens, and sends the message about X in the same wake — the user just said "stop recommending X" and immediately receives a recommendation about X. The docstring's own rule ("a later message about the topic is still allowed") only holds for feedback from an earlier wake; the validator intercepts reopens without notes and reopens of open topics, but not "closed and reopened within the same draft".

2. NOTEBOOK_RULES was not updated for the new reopen semantics. The prompt (prompt.ts:26) still tells the model reopens must come from "明确用户反馈" (explicit user feedback), while the same commit updated the README and the wake contract: reopening is now the judgement's own call on material change ("只有当用户已关闭或暂缓的主题出现重大变化…时才写 reopened"). The controller's prompt-version hash covers NOTEBOOK_RULES, so existing worker sessions keep receiving the contradictory text until replaced; fresh sessions see rules that can suppress legitimate reopens or prompt the model to invent "user feedback" justifications.

Deterministic reproduction

For (1): feed the commitDraft path a judgement draft carrying a close decision, a note on the same topic, a reopen of it, and a message on it — all four commit atomically and forwardPrepared delivers the message in the same wake; on main nothing rejects the reopen. The fix PR carries this as the regression.

For (2): a first-wake session receives NOTEBOOK_RULES containing the outdated reopen rule alongside the new contract in the per-turn injection — directly observable in the prompt text.

Root cause

(1) is a processing-order gap: the reopen guard validates against state that the same transaction just wrote, without distinguishing "closed by the user earlier" from "closed by this draft". (2) is a missed copy update in the same commit.

Suggested fix

(1) Reject a reopen whose governing feedback was written by the same draft (the commit knows its own operation id / the feedback events it just wrote — require the governing feedback to predate the draft, i.e. the reopen may only reopen topics the user closed in an earlier wake). (2) Update NOTEBOOK_RULES to the material-change wording the README and the per-turn contract already use.

Source

Found by an AI-assisted read-only audit (GLM-5.3-Flash via ZCode) over main@112883c85; the processing order, the reopenTopic guards, and the prompt-version hash coverage were re-verified line by line before filing.

Activity

  1. ggbdpq commented on Oct 27, 2026

    @ggbdpq
    ContributorAuthor

    take

  2. added a commit that references this issue on Nov 24, 2026
    9bd98ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions