Skip to content

Navigation stack: AI workspace tools should push navigation entries #54

Closed

Description

@JoshuaRowePhantom

Summary

When AI tools (e.g. entity_invoke_shortcut, workspaces_entity_get with side-effects,
or any tool that opens a tab) navigate the workspace, those navigations should be recorded
in the navigation history stack (see #52) so the user can Ctrl+− back to where they were
before the agent took over.

Context

Issue #52 designs the navigation stack and lists AI tool push as explicitly out of scope
for the initial feature:

AI tool push integration in this feature — tracked separately.

This issue tracks that integration.

Scope

  • Identify all AI tool invocations that result in a tab activation or top-level view change.
  • After each such activation, call INavigationHistoryService.Push with the appropriate
    NavigationEntry.
  • The push must happen after the tab is visible and active, not before, to ensure the
    entry reflects the final settled state.
  • The _navigatingViaHistory guard in MainWindowViewModel must be respected so that
    tool-driven navigations do push (they are not back/forward history traversals).

Key tools to update (once #47 workspace-gui toolset is implemented)

  • entity_invoke_shortcut — whenever Open disposition results in a tab activation
  • Any other workspace-gui tool that activates a tab as a side effect

Acceptance

  • After an agent opens an entity tab via tool call, Ctrl+− navigates back to the
    previously active tab.
  • Multiple sequential tool-driven navigations are all individually reachable via Ctrl+−.
  • Back/forward navigation triggered by the user does not create additional stack entries.

Dependencies

Activity

  1. added a commit that references this issue on Jun 26, 2026
    2ac4e74
  2. JoshuaRowePhantom commented on Jun 30, 2026

    @JoshuaRowePhantom
    OwnerAuthor

    Verification passed

    Checked: Commit 2ac4e74 (Fix #54) on the eatures branch. Files inspected:

    • Phantom.Workspaces/ViewModels/WorkspaceGuiContextProvider.cs — new WorkspaceGuiContextProvider class with �ntity_invoke_shortcut, workspace_close, ab_close, and open_tab tools. �ntity_invoke_shortcut routes Open through ShortcutManager.HandleShortcutAsync on the UI thread, which calls MainWindowViewModel.OpenTabAsync.
    • Phantom.Workspaces/ViewModels/MainWindowViewModel.cs — OpenTabAsync and ActivateTabById both push NavigationEntry when !navigatingViaHistory, satisfying the guard requirement.
    • Phantom.Workspaces/ViewModels/AgentSessionShortcutContext.cs — WorkspaceGuiContextProvider wired into the toolset chain.
    • Phantom.Workspaces.Llm.Core/FixedToolResources.cs — WorkspaceGui constant added and included in DefaultNames.
    • Phantom.Workspaces.Data.Core/.../workspaces-agent-manifest.json — workspace-gui tool resource added.
    • Phantom.Workspaces.Tests/MainWindowIntegrationTests.cs — two new tests: OpenTabAsync_ExistingTab_PushesNavigationEntry and NavigateBack_AfterMultipleToolDrivenNavigations_TraversesAllEntries.
    • Phantom.Workspaces.Tests/WorkspaceGuiContextProviderTests.cs — comprehensive tests for all tool handlers.

    Result: Implementation found, all verification criteria satisfied, tests present and green.

    • ✅ �ntity_invoke_shortcut routes through ShortcutManager → OpenTabAsync → NavigationHistory.Push
    • ✅ _navigatingViaHistory guard respected; user back/forward does not create extra entries
    • ✅ Multiple sequential tool-driven navigations each push an entry (verified by NavigateBack_AfterMultipleToolDrivenNavigations_TraversesAllEntries)
    • ✅ No disabled/skipped tests, no TODOs, no timing-dependent synchronisation in new code
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

    enhancementNew feature or requestverifiedIssue has been verified

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions