Skip to content

Leftovers: early line closes on cancel, terminal plain words, no xhigh defaults, deflake ws auth test, #320 dead code - #326

Merged
lbx154 merged 5 commits into
devfrom
fix/leftovers-a
Oct 24, 2026
Merged

lbx154 merged 5 commits into
devfrom
fix/leftovers-a

Conversation

@lbx154

@lbx154 lbx154 commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Five leftovers, checked against design/ux-principles.md (rule 1 plain words, rule 3 early words, rule 6 status tells the truth).

1. Early line no longer lingers. When a Manager turn is cancelled or crashes after its first words, manager_message writes a closing row for the same message id (ui.argus, in_progress: true, draft_closed: true, empty text). Every reader that skips drafts (map trace/view) skips it too; old clients see an empty row they already hide. The web feed (dropSupersededDrafts) drops the closed draft and the closer; a later draft under the same id (a retried turn) still shows, and a closer never removes a final reply. An error reply replaces the draft as any reply does, so no closer is written then. Tests: tests/test_effort_policy.py (cancelled, crashed, failed-with-error-reply, replied), conversationEvents.test.ts.

2. Terminal. buildEventLines merges the early line with the final reply by message id (the reply replaces it, a draft read back after the reply adds nothing, a closer removes it). Status words (replan_requested, a message ending in continue) and the host's English routing reason ("Nothing changed since the reviewer last held this work…") are said in plain words before any line is shortened. The wording lives in the new frontend/core/src/plainWords.ts; the web's plainProgress.ts now imports plainInternalReason and STATUS_TAIL from there instead of keeping its own copy.

3. xhigh defaults. DEFAULT_LIFE_CONFIG's role efforts were only shown by /config (the run reads the knob) and showed an xhigh that never ran. They are now empty, and /config shows the switch you set or "by need". Two real fallbacks still chose xhigh and now choose high, matching core.effort_policy: resolve_role_reasoning_effort's default (used by the supervisor, the CLI and the daemon's reviewer path) and the Planner's runner option. config_snapshot says "default: by need". Two tests that pinned xhigh are updated.

4. Flaky test_ws_requires_token_when_configured. The cause is real and was reproduced: 1800 stressed teardowns gave about 90 concurrent.futures.CancelledError. The stream handler's cleanup awaited asyncio.gather over helper tasks it had just cancelled. When the server cancelled the handler at the same moment, gather re-raised a helper's anonymous CancelledError, which the cancel scope did not recognise as its own. The handler now waits with asyncio.wait and no longer swallows cancellation. After the fix: 1800 stressed teardowns, 0 failures, and the test passed 30 runs out of 30 in a loop.

5. Dead code (#320). Removed api.generateMapCopy together with the now-unused signal parameter of explanationResponse. The streaming tests now run through generateReaderFoundation / askReaderFoundation. Also removed map_narrative._prepare_cards, _normalize_reader_brief_shape, _reader_brief and schema, plus test_reader_brief_shapes.py; the parser tests in test_map_model.py keep their own small schema. Removed map_history.indexed_evidence and the words prop of MacroTaskNode. Every symbol was grepped in web, TUI, frontend/core and Python before deletion. Net change: +67 / −327 lines.

Tests. Web: vitest 144 files, 1423 passed; tsc clean. TUI: npm test 302 passed, 0 failed; tsc clean. ruff clean. Release artifacts rebuilt; tests/release_tools passes. Full Python suite: everything passes except two tests that also fail on origin/dev: test_liveness_operator::test_a_clicked_option_is_acknowledged_in_the_question_s_language and test_architecture_invariants::test_private_modules_are_not_imported_across_packages (map_relations imports life.delivery._referenced_path_candidates).

🤖 Generated with Claude Code

lbx154 and others added 5 commits October 24, 2026 10:07
…t and says status plainly

A Manager turn that is cancelled or crashes after its first words now writes
a closing row for the same message id (in progress, draft_closed, empty), so
the early line no longer stays at the end of the chat after reload. An error
reply replaces the draft as any reply does. The web feed drops a closed draft
and the closer itself.

The terminal merges the early line with the final reply by message id (the
reply replaces it, a late draft adds nothing, a closer removes it) and says
internal status words and English routing reasons in plain words, from
frontend/core/src/plainWords.ts, now shared with the web feed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DEFAULT_LIFE_CONFIG's role efforts were only shown by /config (the run reads
the knob), and showed xhigh that never ran; /config now shows the operator's
switch or 'by need'. Real fallbacks to xhigh are now high, in line with
core.effort_policy: resolve_role_reasoning_effort's default (supervisor, CLI
and daemon reviewer paths) and the Planner's runner option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th test)

On teardown the handler awaited asyncio.gather over helper tasks it had just
cancelled. When the server cancelled the handler meanwhile, gather re-raised
a helper's anonymous CancelledError, which the server's cancel scope does not
recognise, so the connection ended as cancelled and the TestClient raised
concurrent.futures.CancelledError (~5% of teardowns under load). Wait with
asyncio.wait, which never raises a helper's error, and stop swallowing
CancelledError. 1800 stressed teardowns: 0 failures (was ~90).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
api.generateMapCopy (no production caller; the streaming tests now drive the
shared explanationResponse through generateReaderFoundation and
askReaderFoundation, and its unused signal parameter goes too), map_narrative
_prepare_cards/_normalize_reader_brief_shape/_reader_brief/schema with
test_reader_brief_shapes.py, map_history.indexed_evidence, and the words prop
of MacroTaskNode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lbx154
lbx154 merged commit 0617029 into dev Oct 24, 2026
4 of 5 checks passed
@lbx154
lbx154 deleted the fix/leftovers-a branch October 24, 2026 17:26
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.

1 participant