feat(attach): pass --resume on dashboard re-attach
Re-entering a running bottle from the dashboard (Enter on the agents pane) now invokes claude with `--resume` so the session picks up the prior conversation history rather than starting a fresh transcript. The first-attach paths (`./cli.py start` and the dashboard's new-agent `n` flow) leave it off — the transcript doesn't exist yet there. `attach_claude` gains a `resume: bool = False` kwarg; `_attach_to_bottle` in the dashboard passes `True`.
This commit is contained in:
@@ -656,10 +656,15 @@ def _attach_to_bottle(
|
||||
slug: str,
|
||||
) -> str:
|
||||
"""Handoff: curses.endwin → attach claude → curses refresh.
|
||||
Returns the post-attach status-line message."""
|
||||
Re-entry into a running bottle from the dashboard always
|
||||
passes `--resume` so claude picks up its prior conversation
|
||||
rather than starting a fresh transcript — the first attach
|
||||
happens via `_new_agent_flow` which sets up the transcript
|
||||
in the first place. Returns the post-attach status-line
|
||||
message."""
|
||||
curses.endwin()
|
||||
try:
|
||||
exit_code = attach_claude(bottle, remote_control=False)
|
||||
exit_code = attach_claude(bottle, remote_control=False, resume=True)
|
||||
except BaseException:
|
||||
stdscr.refresh()
|
||||
raise
|
||||
|
||||
@@ -92,15 +92,21 @@ def prepare_with_preflight(
|
||||
|
||||
|
||||
def attach_claude(
|
||||
bottle: Bottle, *, remote_control: bool = False,
|
||||
bottle: Bottle, *, remote_control: bool = False, resume: bool = False,
|
||||
) -> int:
|
||||
"""Run claude inside `bottle` as an interactive session. Blocks
|
||||
until the session ends; returns the claude process's exit code.
|
||||
|
||||
`resume=True` adds `--resume` so claude picks up its prior
|
||||
conversation history rather than starting a fresh transcript —
|
||||
the right shape for the dashboard's Enter re-attach (PRD 0020
|
||||
chunk 3). First-attach paths (`./cli.py start`, the dashboard's
|
||||
new-agent flow) leave it False.
|
||||
|
||||
Used as the inner step of `./cli.py start` (one-shot) and by the
|
||||
dashboard (PRD 0020), which calls it from inside a `curses.endwin
|
||||
→ … → stdscr.refresh()` handoff so the curses surface gets out
|
||||
of the terminal's way while claude has it."""
|
||||
dashboard, which calls it from inside a `curses.endwin → … →
|
||||
stdscr.refresh()` handoff so the curses surface gets out of the
|
||||
terminal's way while claude has it."""
|
||||
info(
|
||||
"attaching interactive claude session "
|
||||
"(Ctrl-D or 'exit' to leave; container will be removed)"
|
||||
@@ -108,6 +114,8 @@ def attach_claude(
|
||||
claude_args = ["--dangerously-skip-permissions"]
|
||||
if remote_control:
|
||||
claude_args.append("--remote-control")
|
||||
if resume:
|
||||
claude_args.append("--resume")
|
||||
return bottle.exec_claude(claude_args, tty=True)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user