Skip to content

feat(harness): thinking default-collapsed preference toggle via Leader+t (plan #742) - #754

Merged
btipling merged 2 commits into
mainfrom
plan/thinking-default-collapsed
Aug 21, 2026
Merged

feat(harness): thinking default-collapsed preference toggle via Leader+t (plan #742)#754
btipling merged 2 commits into
mainfrom
plan/thinking-default-collapsed

Conversation

@btipling

Copy link
Copy Markdown
Owner

plan #742 — thinking default-collapsed toggle via Leader+T

Re-implementation of plan #742 against current main. The original implementation (#751) was stacked on plan/harness-keymap (parent plan #741) and was auto-closed without merging when #746's merge deleted that base branch. Those keymap seams are now on main, so this PR re-implements the plan directly onto main (Zig + docs only).

Fixes #742
Refs #741 (parent keymap)

Change (harness + docs only)

  • thinking_collapse.zig (pure, host-testable) — shouldRenderFull now threads default_collapsed as an explicit boolean parameter:
    shouldRenderFull = operator_open OR (NOT default_collapsed AND isActiveTurnFull).
    Default ON relaxes the Busy pin; OFF restores today's behavior.
  • ui/state.zigthinking_default_collapsed = true, reset to ON in resetTranscriptScroll() (same lifetime/reset site as help_overlay_open / leader_armed). In-memory only; no session meta / protocol carrier.
  • ui/thinking.zig — threads the live preference; the is_active "expanded = true" pin is gated (pinned_active = is_active and !default_collapsed), so when ON an active row's click routes through the normal set-toggle into thinking_open_l1 (expander works mid-Busy). No second if (is_active) pin left that ignores the bool.
  • Keymap seams (all 4)keymap.zig (Action.thinking_default_toggle + KEY_TABLE row thinking_default_toggle + a leader-pending t arm in match, mirroring the ? arm: handled, disarms, never inserts t), ui/keymap_dispatch.zig (Handlers.toggleThinkingDefault seam + a runAction arm that flips + disarms the leader), ui/help_overlay.zig rowChord case (exhaustive switch — compile-forced, Thinking default collapsed / Leader Space, then t), ui.zig seam + dispatch wiring.
  • Docs (timeless, no issue references) — docs/harness-limits.md (keyboard row: Leader then t; Thinking collapse row: Busy pin now preference-gated), docs/agent-stream.md (qualified the absolute "active Busy turn keeps thinking fully expanded").

Verification (Zig gates, all green)

Gate Result
zig fmt --check clean
zig build test-rich 92/92 steps · 1299/1299 passed (keymap 39/39 incl. tests 5/5b/table-cap; thinking-collapse 13/13)
zig build test-rich-invariants green
zig build harness -Doptimize=Debug Wasm compile clean
build-harness CI pending — will update on completion

No TS files touched → vitest / typecheck / DI-cost gates N/A (per the layer rule). No cap added/changed. No Production mutate; build-harness is the existing release gate.

Per the plan's testing lock (#1–6, 5b, 8; #7 compile-forced): tests 1–3 (both preference values + committed rows), 5/5b (leader+t → toggle, disarm, no prompt insert), table-within-cap.

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
invincible Ignored Ignored Aug 21, 2026 8:11am

Request Review

@btipling

Copy link
Copy Markdown
Owner Author

Summary (re-implementation)

This is plan #742's fresh PR against main; the original stacked PR #751 was auto-closed without merging when parent #746's merge deleted its base branch. Reconciled here by replaying the single #742 delta onto the updated main (keymap seams from #746 are now on main). Zig + docs only.

Gates (all green): zig fmt --check clean · zig build test-rich 92/92 steps · 1299/1299 passed (keymap 39/39 incl. leader-t tests 5/5b + table-cap; thinking-collapse 13/13) · zig build test-rich-invariants green · zig build harness -Doptimize=Debug clean · build-harness CI green (run 32459134300, 2m41s, wasm32-freestanding release + artifact upload). PR MERGEABLE / CLEAN.

No TS changed → vitest/typecheck/DI-cost N/A. No cap added/changed; no Production mutate. Plan #742 marked IMPLEMENTED.

Next: adversarial review on this head 2c215e5.

@btipling btipling left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Adversarial review — PR #754

Verdict: PASS WITH NOTES
Repo: btipling/invincible
Scope: mainplan/thinking-default-collapsed · 9 files · Leader+t thinking default-collapsed (#742)
Lenses run: L1, L3, L5, L6, L8, L9 (skip: L2 no secrets/API; L4 no workflow; L7 no clone bind)
AGENTS.md read: yes · docs/feature-divide.md read (preference is Wasm in-memory; no meta / protocol / DOM)

The shape is right: shouldRenderFull = operator_open OR (NOT default_collapsed AND isActiveTurnFull) is the single policy, preference default ON, Busy pin gated in paint (pinned_active = is_active and !default_collapsed) so mid-Busy expand still writes thinking_open_l1. Leader+t is a short-circuit arm in match (same class as ?) — the KEY_TABLE row would never fire without it. fromDvui already has .t (Ctrl/Cmd+T stay reserved → .browser, disarm, no toggle). Dispatch flips then disarmLeader(). Reset on New/Clear/hydrate returns ON. Caps unchanged (KEYMAP_MAX 64, table still well under). Overlay exhaustive switch compiles. Docs qualify the old “Busy stays fully expanded” claim.

Tests lock both preference values + committed rows + leader+t / plain t / Ctrl+T reserved. No dual DOM cheatsheet.

Findings

Sev Lens Finding Break scenario Refutation attempt Confidence
Nit L8 thinking_collapse.zig file header still locks “Busy → every current-turn thinking row FULL” (#424). Product default is now the opposite. Next collapse agent “restores” the Busy pin from the module comment and fights #742. shouldRenderFull body + tests are the real API; header is stale prose. high

Residual risk

  • Test 5b names “disarms / never inserts t” but only asserts match outcome; disarm + handled-mark live in keymap_dispatch (not in test-rich).
  • Overlay greys the new row unless leader_pending (same as leader+?) — technically correct, easy to misread as “unavailable”.
  • Zig test-rich / wasm32 build-harness were not re-run in this review environment.

Merge guidance

  • PASS WITH NOTES: safe to merge from this attack; nits optional
  • Do not persist the preference in session meta / a new inv_* in this PR
  • Do not add a DOM window keydown for Leader+t
  • Do not silently change KEYMAP_MAX / LEADER_WINDOW_MS

What was not attacked

Host zig build test-rich / wasm32 build-harness, live canvas (Leader+t mid-Busy expand/collapse, New session reset), Production harness artifact deploy.

@btipling

Copy link
Copy Markdown
Owner Author

Addressing adversarial-review Nit (L8) from the PASS WITH NOTES review on 2c215e5:

Change

native/harness/src/thinking_collapse.zig — reconciled the module header with the shipped policy (plan #742). The header locked the pre-#742 rule "Busy → every current-turn thinking row renders FULL" (#424). The product default is now the opposite (default_collapsed = true). Reworded the header to state the current rule:

  • default collapsed: active-turn rows render compact unless the operator opened them;
  • OFF preference restores the today Busy pin (active-turn rows FULL);
  • on turn completion everything collapses regardless of preference.

The shouldRenderFull body + tests (the real API) were already correct — this was stale doc prose only.

New head: ec5f709 (author btipling)
Gates on the new head: zig fmt --check clean · zig build test-rich exit 0 · zig build test-rich-invariants exit 0 · zig build harness -Doptimize=Debug clean. Comment-only change (no code logic touched).

CI (zig → harness.wasm, Vercel) is re-running on the new head.

Per merge skill §0a, the head moved (2c215e5ec5f709) which invalidates the prior adversarial PASS — a fresh adversarial review on ec5f709 is required before /merge_pr #754.

@btipling btipling left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Adversarial review — PR #754

Verdict: PASS WITH NOTES
Repo: btipling/invincible
Scope: mainplan/thinking-default-collapsed · 9 files · Leader+t thinking default-collapsed (#742)
HEAD: ec5f709 (header-only follow-up after 2c215e5)
Lenses run: L1, L3, L5, L6, L8, L9 (skip: L2 no secrets/API; L4 no workflow; L7 no clone bind)
AGENTS.md read: yes · docs/feature-divide.md read (preference is Wasm in-memory; no meta / protocol / DOM)

Re-review. Prior Nit (L8: thinking_collapse.zig header still locked “Busy → FULL”) is fixed. Header now matches shouldRenderFull = operator_open OR (NOT default_collapsed AND isActiveTurnFull) and the product default ON.

Logic is unchanged from the previous attack and still holds: leader+t is a match short-circuit (same class as ?); Ctrl/Cmd+T stay reserved; dispatch flips then disarmLeader(); paint pinned_active is preference-gated so mid-Busy expand writes thinking_open_l1; reset on New/Clear/hydrate returns ON; overlay exhaustive switch compiles; caps unchanged; tests lock both preference values + leader+t / plain t / Ctrl+T reserved. No dual DOM cheatsheet.

Findings

None on ec5f709.

Residual risk

  • Test 5b names “disarms / never inserts t” but only asserts match outcome; disarm + handled-mark live in keymap_dispatch (not in test-rich).
  • Overlay greys the new row unless leader_pending (same as leader+?).
  • Zig test-rich / wasm32 build-harness were not re-run here (comment-only delta).

Merge guidance

  • PASS WITH NOTES: safe to merge from this attack
  • Do not persist the preference in session meta / a new inv_* in this PR
  • Do not add a DOM window keydown for Leader+t
  • Do not silently change KEYMAP_MAX / LEADER_WINDOW_MS

What was not attacked

Host zig build test-rich / wasm32 build-harness, live canvas (Leader+t mid-Busy expand/collapse, New session reset), Production harness artifact deploy.

@btipling
btipling merged commit 67d92dd into main Aug 21, 2026
3 checks passed
@btipling
btipling deleted the plan/thinking-default-collapsed branch August 21, 2026 09:06
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.

plan: thinking default-collapsed toggle via keyboard shortcut

1 participant