Repository navigation
refactor(dashboard): give the poisoned-conversation escalation one owner - #20015
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that [DESIGN-REVIEWED] 4f01cd8 Description read[DESCRIPTION-READ] e216f38cd9cd157590e42fabdb8d9bf86223a7feedf99b1263b5bd5c2afabeb6 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 |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS
Not justified as shipped
What this change shipsInventory (5 items) — 3 justifiedIntent: give the poisoned-conversation escalation's cross-turn state one owner (#2295). This is an ADDITION (refactor) with no behaviour change.
[FIRST-PRINCIPLES-REVIEWED] 4f01cd8 Description read[DESCRIPTION-READ] 675598dc4639f1482bd7b218fa3df1f3f484e2807373c623bfed3ff3b598fefc That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
HOLD at f2dda38. This refactors the path that discards native conversation state. That data-removal path remains reserved for a human maintainer. Please answer the First Principles question about the second writer. The replay ledger still refunds the one-shot by attribute name. The ownership claim and AST test should describe that exception honestly. Alternatively, route the refund through the named owner. I read #2295: neighbouring ladders are possible future candidates. I am not requiring new issues merely for that optional extension. Source was reviewed; no tests or state-discard operations were executed. — crew-pr-reviewer (r99) |
|
Thanks. Point by point, on cfde8af (one commit on top of f2dda38):
Tests run on cfde8af:
|
The escalation's cross-turn state (the pre-stream exhaustion streak and the discard one-shot) was written inline at six places in _run_chat, interleaved with the canary's Stop snapshot and the turn's discard flag. PoisonedConversationEscalation now owns every transition: _run_chat records terminal failures, activity and landed turns, asks whether a probe is due, takes the canary's Stop fence and arms a discard through it. The two cells stay slot fields so the replay ledger keeps re-arming the one-shot by name. Behaviour is unchanged. A source scan pins that only the escalation and the slot constructor write either cell.
cfde8af to
5c612dd
Compare
|
HOLD at 5c612dd. Our r99 ask is resolved. The replay ledger no longer refunds the one-shot by attribute name (recovery_replays.py#L208-L222). The refund goes through Two items keep this on HOLD:
— crew-pr-reviewer (r100) |
…h its owner The image-history and thinking-binding replay policies re-armed the poisoned-conversation one-shot by slot attribute name, so the cell kept a second writer outside PoisonedConversationEscalation. The policies now ask for the refund (refunds_discard_one_shot) and the runner's re-arm calls the owner's new refund_one_shot seam at the same two seams (drain and consume). The one-owner pin now also flags any string naming a cell outside the owner and the slot's __slots__/__init__, which is how a by-name refund table reaches a cell; it lists the four old refund entries on the previous head. The canary's two Stop counters go back to being locals of the turn, read before the probe and compared after it as on main: they never outlive the turn, so they are not the escalation's state. ProbeFence, begin_probe and their test are removed. No behaviour change.
5c612dd to
4f01cd8
Compare
|
Thanks @iamwhatever, for r100 and for checking each seam against the inline writes it replaces. Resolved, as you confirmed on 5c612dd: the replay ledger refunds the one-shot through First Principles CONCERNS (
Tests on 4f01cd8:
With that, nothing else from r100 is open on 4f01cd8. Because this PR changes the data-removal path, it waits for a human maintainer's approval. Auto-merge stays off. |
mbriones98
left a comment
There was a problem hiding this comment.
Checks green and readiness passed at 4f01cd8; no behavior change.
Problem / Motivation
Goal: The poisoned-conversation escalation's cross-turn state has one owner that
_run_chatcalls into, instead of being written inline at six places in the turn.The escalation (and the image-history and thinking-binding recoveries that share its discard) spreads its state machine across the pre-stream exhaustion streak, the discard one-shot, the turn's thinking flag, the canary's Stop snapshot and the turn's discard flag. Their transitions are interleaved through
_run_chat's error handler andfinally. Design Review flagged this on #2239: each transition is sound, but the fields deserve one owner.Why it matters
Every recovery that joins this escalation (the thinking-binding rebuild from #19852 is the latest) adds more inline writes to the same two cells. A change to one transition then has to be checked against every other site by hand, which is how a streak that should break, or a one-shot that should stay spent, gets missed.
Not a goal
What changed (motivation → approach → change)
Symptom: the streak and one-shot are mutated inline in the landed-turn block, the thinking-binding rebuild, the image-history recovery, the terminal branch (count, probe check, canary discard) and the
finally. Approach: one helper owns every transition;_run_chatreports facts and asks questions.dashboard/poisoned_escalation.py:PoisonedConversationEscalationwith the seams the issue proposes:record_terminal_failure(emitted, thought, transient),record_activity(emitted, thought),record_landed_turn(),should_probe(),arm_discard(clear_streak=...)andrefund_one_shot().POISONED_SESSION_CYCLESlives there and the runner re-exports it, so its import path keeps working._run_chatbuilds one_escalationper turn and calls those seams at all six sites. The canary probe itself (run_bg_oneliner) stays in_run_chat, where a guard test reads it._ChatSlotfields, and the helper reads and writes them. The recovery-replay ledger's refund goes through the helper too: the image-history and thinking-binding policies setrefunds_discard_one_shotinstead of naming the cell in their(attribute, value)refund tables, and the runner's_rearm_allowancescallsrefund_one_shot()at the same two seams (the drain and the consume seam). Ownership is enforced: a source scan fails if anything in the package other than the helper and the slot's__slots__and constructor writes either cell or names one in a string.finallyconsumes it. So do the two Stop counters the canary reads before the probe and compares after it, unchanged from main. The helper holds only what outlives the turn.docs/system-specs/modules/learn-cron-dashboard.mdgains the helper.Backwards compatibility
Compatible: the same cells, the same transitions in the same order, and
POISONED_SESSION_CYCLESstill resolves on the runner.Removes nothing: no field, key, path or public name is removed; the six inline writes become calls to the helper that performs them.
Tests
test/test_poisoned_escalation.py:_ChatSlot's__slots__and__init__; a parametrized check shows the scan sees assignment, augmented, annotated, tuple, chained,del, literalsetattr, a(name, value)refund table and agetattrby name.TestRunChatTransientRetryintest_dashboard_chat.py(poisoned discard, canary, Stop-during-canary, one-shot, image-history, thinking-binding),test_recovery_replays.py,test_chat_requeue_resolved_stop.py,test_chat_runner_composition_contract.pyandtest_start_priority.py(502 passed). A wider related set of 96 files gave 10213 passed. The only failures were 13 environment-dependent tests that fail identically on main in the same local environment. On the second commit (the ledger refund through the helper),test_recovery_replays.py, whose drain and consume tests assert which one-shot each family's cancellation refunds, passes unchanged, with the suites above and the session-not-found, model-access, promise-only, refusal-replay, cross-surface Stop and canary probe suites (1522 passed). With the canary's Stop counters back as turn locals,TestRunChatTransientRetry(Stop-during-canary included) and the escalation, recovery-replay, requeue, composition-contract and start-priority suites pass unchanged (504 passed).Manual verification
N/A: a refactor with no behaviour change. The existing
_run_chattests drive every escalation path end to end.Related Issues
Fixes #2295
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.