Setting to restore tasks at launch without resuming their agents

未关闭
#293 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
tooling

调研方向

Start by reading src/store/persistence.ts and TaskAITerminal.tsx to trace how restored agents are started, then locate the store, settings, and IPC patterns for the proposed setting and live-PTY check. Add the Behavior checkbox and suspended restore path, and cover the setting-off/on cases, live-PTY reattach, persistence round trip, and Resume behavior with tests. Done means launch respects the setting while Resume and reattachment retain their described behavior.

由索引模型根据 Issue 内容生成。

描述

When Parallel Code starts, it resumes the agents of every open task. loadState creates each persisted agent with resumed: true and status: 'running', and mounting its terminal starts the agent with its resume args: claude --resume <id> or codex resume <id> when the session id is known, and otherwise the agent's resume args, such as claude --continue or codex resume --last. They all start at once.

With a dozen tasks open, a dozen agents re-enter their conversations as soon as the app opens, including the ones I'm not about to work on. The cost we noticed was with Claude Code: sessions close to their context limit compacted right after launch, several at the same time. Most of the time I open the app to work on one task. Collapsing a task keeps its agent stopped, but it also takes the task out of the layout.

Proposal

A setting under Behavior: Resume agent sessions on launch.

When it's off, restored agents are not started. Each shows "Session suspended" with the existing Resume and Restart controls, and Resume continues the conversation the same way launch does today. An agent whose process is still running (after a renderer reload, for example) reattaches as it does now, since that spawns nothing.

I'd default it to on, so nothing changes for existing users. We run it off in our fork, but that's our preference.

What a PR would contain

We've used this in our fork (miadisabelle/mia-parallel-code) since July, and it is merged onto 3.1.0. About 150 lines:

  • src/store/persistence.ts: unless the setting is on or the agent's PTY is still alive, a restored agent is created suspended (status: 'exited', signal: 'suspended') and is left out of the spawn path.
  • A ListRunningAgentIds IPC channel, so the restore can tell a live PTY from one that needs a new process before anything mounts.
  • TaskAITerminal.tsx: a suspended agent mounts neither its terminal nor its chat view, since mounting either starts it. The exit badge reads "Session suspended".
  • restartAgent and switchAgent clear the flag. The setting itself lives in the store, persistence and autosave, with a checkbox in Settings.
  • Tests: suspended when the setting is off, resumed when it's on, live-PTY reattach, the setting's round trip, and Resume clearing the flag.

Would you take a PR for this? If you'd rather solve it another way, I'll follow that.

🤖 Generated with Claude Code

主要语言
TypeScript
星标
1k
派生
144
平均合并
4 天 19 小时
30 天内合并 PR
28

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

johannesjo/parallel-code 的其他 Issue

查看 johannesjo/parallel-code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。