Skip to content

fix(tui): guard Tumblers pin geometry and re-enable Visualizer tab - #890

Merged
Twixes merged 4 commits into
mainfrom
posthog-code/fix-visualizer-tumblers-bounds
Aug 10, 2026
Merged

fix(tui): guard Tumblers pin geometry and re-enable Visualizer tab#890
Twixes merged 4 commits into
mainfrom
posthog-code/fix-visualizer-tumblers-bounds

Conversation

@Twixes

@Twixes Twixes commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Problem

The Visualizer tab was crashing agent runs on short terminals (Cannot set properties of undefined (setting '12')) and was removed in #787 to stop the bleeding. The team wants it back.

Root cause: the Tumblers visual (EnvSetup / "Wiring Up Secrets") computed a pin's target row as cylinderBottom - 1 - (i % 3) - Math.floor(i / 2). On a short panel that can resolve above the top of the cylinder — even negative — and the value was stored as a settled height and then written back via grid[negativeRow][pinX], indexing an undefined row and throwing.

Changes

  • Clamp targetForPin to the cylinder interior ([cylinderTop, cylinderBottom]) so a pin can never settle above the top or below the floor.
  • Bounds-check the settled-pin and falling-pin grid writes, matching how the sibling visuals guard theirs.
  • Re-add the visualizer tab entry (and its VisualizerTab import) to RunScreen.

Test plan

  • pnpm build passes (incl. smoke + warlock smoke tests)
  • pnpm lint clean (0 errors)
  • Visualizer tab renders again alongside Status / Event plan / Tail logs / HN; no crash on short panels.

Created with PostHog from a Slack thread

Clamp each pin's target row to the cylinder interior and bounds-check grid
writes so the EnvSetup ("Wiring Up Secrets") visual no longer indexes a
negative row on short panels. Re-adds the Visualizer tab to RunScreen that
was removed to dodge the crash.

Generated-By: PostHog Code
Task-Id: 9da2b460-5d1c-417f-8c31-9eb684681fc6
@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

… helper

The Tumblers crash was one instance of a broader class: every phase visual
built a raw character grid and did unguarded `grid[y][x] = ch` writes, so any
miscomputed coordinate on a short/narrow panel could index an undefined row
and crash the whole TUI. LibraryShelf had the same latent bug (negative
`shelfY - 1` at small heights).

Introduce a shared `grid.ts` (`createGrid` / `plot` / `writeText`) where an
out-of-bounds coordinate is a silent no-op, and route every grid-based visual
(Tumblers, LibraryShelf, CrateStack, DashboardGrid) through it so a geometry
bug degrades to a cosmetic glitch instead of a crash. Also harden DiffCascade's
line-buffer access against a resize. Adds unit tests covering the guarantee,
including the exact negative-row case that produced the original error.

Generated-By: PostHog Code
Task-Id: 9da2b460-5d1c-417f-8c31-9eb684681fc6
@Twixes
Twixes marked this pull request as ready for review August 3, 2026 19:16
@Twixes
Twixes requested a review from a team as a code owner August 3, 2026 19:16

@edwinyjlim edwinyjlim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

math.approve()

@sarahxsanders

Copy link
Copy Markdown
Collaborator

yayyyy!!!

@Twixes
Twixes enabled auto-merge (squash) August 6, 2026 15:28
@Twixes
Twixes merged commit 74edd5f into main Aug 10, 2026
16 checks passed
@Twixes
Twixes deleted the posthog-code/fix-visualizer-tumblers-bounds branch August 10, 2026 08: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.

3 participants