Skip to content

fix(tui): preserve launch context in resume commands - #5467

Open
Wsp030914 wants to merge 1 commit into
HKUDS:mainfrom
Wsp030914:fix/tui-resume-context
Open

fix(tui): preserve launch context in resume commands#5467
Wsp030914 wants to merge 1 commit into
HKUDS:mainfrom
Wsp030914:fix/tui-resume-context

Conversation

@Wsp030914

Copy link
Copy Markdown
Contributor

Summary

  • preserve explicit --config and --workspace selectors in TUI resume commands
  • apply the same launch context to both normal exit and /detach
  • quote selector paths for POSIX shells and PowerShell
  • keep implicit defaults implicit
  • add regression tests and update documentation

Reproduction

  1. Start the native TUI with a valid non-default config and workspace:

    nanobot agent --config 'C:\tmp\nanobot alt\config.json' --workspace 'C:\tmp\nanobot alt\workspace'
  2. Start or select a session.

  3. Exit the TUI, or use /detach.

  4. Observe the printed resume command.

Before this fix, the command contains only the session ID:

nanobot agent --session websocket:<chat-id>
  1. Run that command from another directory or environment using the default
    nanobot configuration.

Actual behavior

The explicit config and workspace selectors are lost. The resume command may
connect to the default nanobot instance instead of reopening the session in its
original launch context.

Expected behavior

The printed command preserves the explicitly supplied selectors:

nanobot agent --config 'C:\tmp\nanobot alt\config.json' --workspace 'C:\tmp\nanobot alt\workspace' --session websocket:<chat-id>

When no selectors were explicitly supplied, the existing short command should
remain unchanged.

Implementation

The Python TUI launcher forwards only explicitly supplied config and workspace
selectors through TUI-specific environment variables.

The TUI uses those values only when formatting resume commands. The canonical
config path used internally by the gateway remains unchanged.

Testing

  • uv run --no-sync pytest tests/cli/test_tui_launcher.py -q
  • uv run --no-sync ruff check nanobot/cli/agent.py nanobot/cli/tui_launcher.py tests/cli/test_tui_launcher.py
  • uv run --no-sync basedpyright nanobot/cli/agent.py nanobot/cli/tui_launcher.py
  • cd tui && bun run check
  • cd tui && bun run test
  • cd tui && bun run build
  • git diff --check
  • manually verified the resume command on PowerShell

Follow-up to #5452 and #5461.

Forward only explicit config and workspace selectors so printed commands reopen the same instance without breaking implicit defaults.

Refs HKUDS#5452
@chengyongru chengyongru added bug Something isn't working documentation Improvements or additions to documentation fix priority: p2 Normal backlog: minor bug, enhancement, docs, cleanup, edge case, or unvalidated proposal. test conflict labels Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working conflict documentation Improvements or additions to documentation fix priority: p2 Normal backlog: minor bug, enhancement, docs, cleanup, edge case, or unvalidated proposal. test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants