Skip to content

Dashboard card actions target the instance by Name (hits a terminated or other user's same-named instance) and cards re-render every ~125 ms so clicks are lost #128

Closed

Description

@scttfrdmn

Found by the portal functional audit (2026-11-10, spawn-ts 0.8.1). These are two defects in ui/dashboard.js, separate from #125 (errors are swallowed). Each one alone explains "the buttons do nothing".

1. Card actions resolve the instance by Name, not by its id

instanceCard() wires every button to this.client.<op>(i.name) (dist/ui/dashboard.js:568-578). SpawnClient.resolve() then runs provider.get(name), which is DescribeInstances filtered on tag:Name and returns the first instance in the first reservation (aws/ec2.js:223-233). That instance can be terminated, or it can belong to someone else. Name is not unique: a guided user relaunches the same shape, and CLI users reuse names.

Evidence from a Playwright run with a stubbed SDK. The account had a live spot test (i-0bbb…) and an older, terminated test (i-0ccc…). I clicked buttons on the live card:

stop                 -> ec2:StopInstances(i-0ccc000000000000c) -> IncorrectInstanceState (unhandled)
hibernate            -> ec2:StopInstances(i-0ccc…)[Hibernate]  -> IncorrectInstanceState (unhandled)
extend 1h            -> ec2:CreateTags + ssm:SendCommand(i-0ccc…)
signal complete      -> "test has no on-complete action" (unhandled)
terminate + confirm  -> ec2:TerminateInstances(i-0ccc…) -> ok

Real EC2 accepts TerminateInstances on an already-terminated instance. So "terminate" returns success while the instance the user clicked keeps running and billing. If the other test had been a live instance (another user's, since the list is account-wide), the click would have terminated the wrong machine.

Fix: pass i.instanceId. resolve() already accepts ids (get() branches on i-). Also make get(name) skip terminated instances and refuse ambiguous names.

2. Cards are rebuilt every ~125 ms, so human-speed clicks are lost

renderInstances() replaces every card on each instances event (:456-467), and the monitor emits two of those per 250 ms tick (spawn-ts#127). A press-and-release that takes longer than the gap between renders lands mousedown and mouseup on different elements, so no click fires. Measured: a 180 ms press on "terminate" opened no confirmation modal. The disabled state set in actionBtn is wiped by the next render too, so even a click that registers shows no progress.

Fix: diff cards by instanceId, update meters in place, and keep an action's busy state across renders.

Also: signal complete on a real provider

signalComplete() calls applyAction directly (core/client.js:435-447): on real AWS that's an immediate terminate or stop with no confirmation, presented as a demo affordance. Hide it for real providers, or confirm it like terminate.

Tests:

  • Two instances share a name, one terminated. Every card action targets the clicked card's instanceId.
  • A card re-render between mousedown and mouseup still delivers the click (or there's no re-render while the instance is unchanged).

Activity

  1. added this to the Hardening milestone on Nov 10, 2026
  2. added
    bug
    area: ui
    cost-safety
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: uibugcost-safety

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions