Skip to content

panels: disarm the pending delete on the network toggle key - #163

Merged
codeyevsky merged 2 commits into
solongate:mainfrom
tianxingjian2406:fix/issue-153
Oct 26, 2026
Merged

codeyevsky merged 2 commits into
solongate:mainfrom
tianxingjian2406:fix/issue-153

Conversation

@tianxingjian2406

Copy link
Copy Markdown
Contributor

Fixes #153

What

In the sandbox panel, pressing m (network toggle) now clears a pending delete confirmation, the way the navigation keys already do.

Why

d arms a two-press delete confirmation. m left that state armed, so after m a single d deleted the box without the second press the prompt promises. up/down and the edit keys already cleared the state; m was the one gap.

How

One line in packages/tui/panels/sandbox_keys.go: clear p.confirm in the m case, before the save command. A delete now fires only when the d follows the d that armed it.

Tests

  • Added TestSandboxKeyMDisarmsPendingDelete. Red before the fix: after m, confirm stayed "001" and the next d returned a delete command. Green after: m disarms the state, and the next d re-arms instead of firing.
  • go test ./panels/ targeted: TestSandboxKeyNavigation, TestSandboxKeyDRequiresConfirmation, TestSandboxKeyDNoCurrentEntryIsNoOp, TestSandboxKeyMNoCurrentEntryIsNoOp, and the new test all pass (go1.26.10, windows/amd64).
  • go build ./... and go vet ./... are clean in packages/tui. The changed lines are gofmt clean.
  • Full go test ./... in packages/tui on Windows shows 18 failures. They are identical on a clean checkout of main: the tests isolate state through $HOME, which Windows ignores, so they share one store. Not caused by this change; CI runs them on ubuntu.
  • I did not drive a real agent client by hand for this. The change is pure TUI key-state handling, and the added unit test covers the reported sequence directly.

Pressing m toggles the network setting. It left an armed delete confirmation alive, so the next d deleted the box without the second press the prompt promises. Clear p.confirm on m like the navigation keys do. A delete now fires only when the d follows the d that armed it.

Signed-off-by: tianxingjian2406 <2550975@tongji.edu.cn>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 21:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@codeyevsky
codeyevsky merged commit d421e3b into solongate:main Oct 26, 2026
34 checks passed
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.

panels: sandbox network toggle leaves a pending delete armed across keypresses

3 participants