Skip to content

feat(linux): add recent-history cleanup - #33

Merged
melonamin merged 2 commits into
melonamin:linux-portfrom
MemberIT:fix/linux-clear-recent-items
Sep 3, 2026
Merged

melonamin merged 2 commits into
melonamin:linux-portfrom
MemberIT:fix/linux-clear-recent-items

Conversation

@MemberIT

Copy link
Copy Markdown

What

Linux exposes recently closed sessions and workspaces through Reopen Last Closed Item, but it has no way to clear that persisted history. Upstream macOS provides File ▸ Open Recent ▸ Clear Menu; on Linux neither the command palette nor the control socket calls the existing host-free WindowLibrary.clearRecentClosedItems() seam.

This PR closes parity GAP Б4 by adding Clear Recent Items to the Linux command palette whenever the history is non-empty. The same app-global mutation is available as agtermctl recent clear / recent.clear, returning result.affected with the number of entries removed.

Cause

The storage and mutation already existed in agtermCore:

  • RecentClosedStore.clear() atomically persists an empty recent-closed.json state;
  • WindowLibrary.clearRecentClosedItems() clears the store and refreshes the observed in-memory list.

The missing piece was every caller. Linux's palette only exposed reopen, and the public control catalog had no recent-history cleanup command. The existing method was therefore reachable only from the macOS File menu.

Minimal reproduction

  1. Close a session or workspace on Linux so it appears in the recently closed history.
  2. Open the command palette with Ctrl+Shift+P and search for Clear Recent Items.

Expected (upstream parity): a cleanup action is available and removes the persisted recent-closed history. Actual before this PR: no matching palette action exists, and agtermctl has no equivalent command.

The new Docker AT-SPI scenario performs this exact flow, reopens the palette to prove the action disappears after clearing, then creates one more recent item and verifies agtermctl recent clear --json reports result.affected == 1.

Change

Commit a315bf1 — feat(linux): add recent-history cleanup:

  • Linux palette — adds the conditional Clear Recent Items row and routes it through the existing WindowLibrary mutation.
  • Control API — adds recent.clear to Command, ControlDispatcher, the Linux synchronous dispatcher, both app-host adapters, and Linux's app-global controller routing. The response reports the removed entry count through the existing result.affected field.
  • CLI — adds agtermctl recent clear to the shared agtermctlKit catalog, so macOS and Linux parse the same command.
  • Coverage — adds persisted-store, protocol round-trip, dispatcher-routing, CLI-parser, and real GTK/AT-SPI coverage.
  • Documentation — updates README.md, the public command reference, the bundled agent skill, and the internal control catalog. The stale numeric command count in README.md is removed per the repository's no-count rule.

Scope note

Recent-closed history cleanup only. Reopen behavior, close/undo timing, session and workspace state, keymap syntax, persisted model versions, and libghostty behavior are unchanged. The action uses the existing clear seam rather than adding a second persistence path. CHANGELOG.md remains untouched because this is not a release change.

Keep-in-sync

Control coverage is included because clearing history is a meaningful user-visible mutation: protocol case, host-free dispatcher, macOS and Linux host actions, Linux synchronous routing, shared CLI parser, protocol/dispatcher/CLI tests, and an end-to-end socket exercise all move together.

The bundled agent skill and site/commands.html document recent.clear and result.affected. No tree read-back field is added: this is app-global history cleanup rather than per-session mutable state, and the command returns the exact affected count. The keymap and window/workspace/session/pane models are unchanged.

Testing

All tests and builds were run inside a purpose-built swift:6.3.2-noble Docker image carrying the workflow's GTK4/libadwaita, AT-SPI/Xvfb/Openbox, Mesa, Zig 0.16.0, libghostty, and SwiftLint 0.65.0 dependencies. No Swift tests or app builds were run on the host.

  • swift test in agtermCore: 2574 tests / 97 suites passed, including the new persisted clear, protocol, dispatcher, and CLI parser coverage.
  • scripts/check-linux-core-boundary.sh 834b74a7f78de06e1c4f66c5e24eafccd047ec64: passed.
  • scripts/check-linux-cli-drift.sh: passed.
  • scripts/test-linux-architecture.sh: passed.
  • scripts/test-linux-resources.sh: passed.
  • scripts/setup-linux.sh + scripts/verify-linux-vendor-cache.sh: built and verified the pinned libghostty/resources cache.
  • swift test in agterm-linux: 332 tests / 47 suites passed.
  • swift build and swift build -c release in agterm-linux: passed.
  • Targeted GTK AT-SPI smoke, AGTERM_ATSPI_SCENARIO=recent-clear scripts/test-linux-ui.sh: passed with OK: palette and control clear recently closed items.
  • swiftlint lint --strict --quiet: clean.
  • git diff --check: clean.

@MemberIT
MemberIT requested a review from melonamin as a code owner August 28, 2026 11:53
@melonamin
melonamin force-pushed the fix/linux-clear-recent-items branch from 05323b3 to 9b4fbf7 Compare September 3, 2026 00:08
@melonamin
melonamin merged commit 6b584a4 into melonamin:linux-port Sep 3, 2026
5 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.

2 participants