Skip to content

fix(desktop): TODO の ScheduleWakeup 再開時のゴリ押し解消と待機UI改善 (#240)#244

Merged
MocA-Love merged 2 commits intomainfrom
cyan-sense
Apr 17, 2026
Merged

fix(desktop): TODO の ScheduleWakeup 再開時のゴリ押し解消と待機UI改善 (#240)#244
MocA-Love merged 2 commits intomainfrom
cyan-sense

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

概要

#240 対応。TODO 機能で Claude Code が ScheduleWakeup でセッションを自己休止したあと、スケジューラーが再開する際の挙動と UI をまとめて改善する。

背景

従来の動作には 3 つの課題があった。

  1. ゴリ押し再開: 待機後の再開時に runSession() が iteration=1 から再スタートし、buildIterationPrompt() が元の goal.md パス / タイトル / 説明 / ゴールをまるごと再送していた。Claude 側から見ると --resume で同じ会話が続いているのに、ユーザーメッセージとして同じ指示が 2 回届く状態。加えてストリームに「セッションを再開します。これより下が新しいターンのストリームです。」のバナーが毎回挿入されていた。
  2. 「最終回答」欄の表示: waiting 中でも詳細ペインのラベルが「最終回答」のままで、待機前の応答が最終回答として誤読される。
  3. 待機時間の見える化: waitingUntil は保持しているのに詳細ペインにカウントダウンがなく、行ラベルの「N分後」しか手がかりがなかった。

変更点

バックエンド

  • TodoSupervisor.start(sessionId, { fromScheduledWakeup }) を追加。スケジューラー駆動の再開を識別する内部マーカー (wakeupResumeMarkers) を導入し、runSession() が 1 度だけ消費する設計。
  • TodoScheduler.resumeDueWaitingSessions()fromScheduledWakeup: true を付けて start() を呼ぶ。
  • wakeup 再開時は:
    • appendSetupEvent("再開", …) をスキップ。
    • DB の finalAssistantTextnull にクリア(「待機中」→「最終回答」への切替時にフィールドが空になる / 次ターンのストリームが前ターンの答えを上書きしない)。
    • buildIterationPrompt() の専用ブランチで短い継続キュー "(予定時刻になりました。前回の続きから作業を再開してください。)" のみを送る(元プロンプト / システムプロンプト / verify 注記は再送しない)。
  • 手動 start()(ユーザー操作・フォローアップ介入)は常に stale なマーカーを先に削除して上書きする。abort() 時もマーカーを削除。

UI(TodoManager.tsx

  • status === "waiting" のとき「最終回答」ラベルを 「待機中」 に差し替え、コピーボタンのタイトルも「待機前の応答をコピー」に変更。
  • 詳細ペインに 「待機終了まで」 ブロックを追加。MM:SS(1 時間超で HH:MM:SS)形式のカウントダウンと waitingReason を併記。既存の 1 秒 tick (completedAt == null) でライブ更新される。

Test plan

  • TODO セッションで Claude に ScheduleWakeup を発火させる
    • 「セッションを再開します」バナーが表示されないこと
    • 再開直後のユーザーメッセージが短い継続キューだけで、元プロンプトの再送がないこと
    • 待機中は「待機中」ラベルで前ターン応答が表示されること
    • 「待機終了まで」ブロックが MM:SS でライブカウントダウンされること
    • 再度 running に戻った時点で「最終回答」ラベルに戻り、前ターン応答が消えてから新しい応答がストリームされること
  • 通常の done→フォローアップ再開では従来どおり「セッションを再開します」バナーと finalAssistantText の保持が効いていること
  • abort 後に再度手動 start した場合、wakeup マーカーが残らず正常再開すること
  • bun run lint / bun run typecheck 緑(ローカル確認済み)

Closes #240

- scheduler: wakeup 由来の start に `fromScheduledWakeup` フラグを渡す
- supervisor: wakeup 再開は「再開」バナーを出さず、元プロンプトを再送せず
  "(予定時刻になりました。前回の続きから…)" の短い継続だけを渡す
- supervisor: wakeup 再開時は `finalAssistantText` を null に戻して UI を
  クリーンスレートに(次ターンのストリームが前ターンの答えを上書きしない)
- UI: `status === "waiting"` のときは「最終回答」ラベルを「待機中」に切替
- UI: 詳細ペインに「待機終了まで」ブロック(MM:SS カウントダウン + 理由)を追加
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

Warning

Rate limit exceeded

@MocA-Love has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 41 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 44 minutes and 41 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 42ccd166-478c-493d-bfda-71fcbfe61b18

📥 Commits

Reviewing files that changed from the base of the PR and between 703b976 and ac4679d.

📒 Files selected for processing (3)
  • apps/desktop/src/main/todo-agent/scheduler.ts
  • apps/desktop/src/main/todo-agent/supervisor.ts
  • apps/desktop/src/renderer/features/todo-agent/TodoManager/TodoManager.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cyan-sense

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MocA-Love
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ba5137f6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/todo-agent/supervisor.ts Outdated
`isScheduledWakeupContinuation` は `claudeSessionId != null`
(= 実際に `--resume` できる状態)も条件に加える。parked turn が
`session_id` を取れなかった稀ケースで、継続キューだけの短プロンプトが
空っぽの新規会話に投げられてコンテキストを失う事故を防ぐ。
@MocA-Love MocA-Love self-assigned this Apr 16, 2026
@MocA-Love MocA-Love merged commit 6764b38 into main Apr 17, 2026
6 checks passed
@MocA-Love MocA-Love deleted the cyan-sense branch April 17, 2026 00:00
MocA-Love added a commit that referenced this pull request Apr 17, 2026
…chment を daemon へ移植

main 取り込み側で supervisor.ts に加わった以下の機能を、daemon 方式の
新しいアーキテクチャ (supervisor-engine.ts) に再実装する。

#244 ScheduleWakeup 継続
- engine に `wakeupResumeMarkers` を追加し、scheduler からの
  `fromScheduledWakeup: true` を経由してマーカーを立てる
- `start()` option をIPC プロトコル (StartRequest) に追加し、
  supervisor.ts (proxy) → client.ts → daemon/index.ts → engine.start
  の順にフラグを伝搬
- `runSession` がマーカーを消費し「再開」バナー/previous text 再送を
  スキップして短い継続キューだけを送る
- `buildIterationPrompt` に `isScheduledWakeupContinuation` を追加、
  claudeSessionId が null のときは iteration-1 フルプロンプトへ
  フォールバック

#245 Claude model/effort
- `runClaudeTurn` に `claudeModel`/`claudeEffort` を渡し、
  CLAUDE_*_OPTIONS ホワイトリストで検証してから `--model`/`--effort`
  を spawn に追加(不明値は warn して無視する二重防御)
- setup event に「Claude 設定」として選択内容を表示

#250 画像添付 tool_result
- `extractToolResultDetails` が image ブロックのみの tool_result も
  `[画像 N 件]` プレースホルダで emit するよう修正
- `extractAttachmentPaths` を daemon 側にも複製し、iteration 1 の
  プロンプトに添付ファイルパスを列挙して Read を促す

#243 done→resume は trpc-router.ts 側で完結するので追加変更なし
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.

[bug] TODO機能のclaude codeのスケジュール対応

1 participant