Skip to content

fix(autopilot): do not block a worker that returns hitl without a reason (#2632) - #2634

Open
smalruby3-editor-bot[bot] wants to merge 1 commit into
developfrom
topic/autopilot-2632
Open

smalruby3-editor-bot[bot] wants to merge 1 commit into
developfrom
topic/autopilot-2632

Conversation

@smalruby3-editor-bot

Copy link
Copy Markdown

Summary

worker が signal: "hitl" を返したのに reason を書き漏れると、validateResult が結果を不正として daemon が Blocked にしていた(#2621 の review の worker が、Bot のトークンが取れないときに実際に起きた)。人間がモニターで見ると「止まった」になり、何をすればよいか分かりにくい。

Changes Made

  • tools/autopilot/src/contract.js: 純粋関数 normalizeResult を足し、readResultFile が検証の前に呼ぶ。signal=hitl で reason が無い・空のとき、summary があればそれを理由として受ける(人間待ちになり、Blocked にしない)。summary も空なら従来どおり不正。文字列でない reason は補わない。validateResult 自体は厳しいまま。
  • docs/autopilot/autonomous-contract.md §2.3: reason は必ず書くこと・書き漏れたときの扱いを表に書き、Bot のトークンが取れないとき(hitlKind: "environment"・reason に再ログインの手順)の例を足した。
  • フェーズのプロンプト 8 つ(「人間に選んでほしいことがあるとき」の節)に、reason を必ず書くことと、トークンが取れないときの書き方を足した。

Test Coverage

  • tools/autopilot/test/contract.test.js に 3 件(normalizeResult の補う・補わない場合、readResultFile が reason 無しの hitl を受ける)。修正前に落ち、修正後に通ることを確かめた。
  • ローカルで流したもの: contract / ask / resolve-conflict / phases / resend / state-machine のテスト、bin/lint-changed。

マージのあとは daemon の再起動が要る(プロンプト・コードは起動時のスナップショット)。

Closes #2632

🤖 Generated with Claude Code

A worker returning signal=hitl without reason was marked invalid and Blocked. readResultFile now
fills the reason from the summary (normalizeResult) before validation. The contract and the phase
prompts state that reason is required, with an example for the Bot token failure case.

Closes #2632

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@smalruby3-editor-bot smalruby3-editor-bot Bot added the 🤖 autopilot autopilot が処理対象にした Issue/PR(daemon が付与) label Nov 29, 2026
@smalruby3-editor-bot

smalruby3-editor-bot Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Author

🤖 autopilot status

field value
Status Review
AI Status —
HITL Yes
Size middle

いま: 👀 レビュー待ち — あなたのレビューを待っています

Linked issue #2632. Maintained by autopilot (single writer); do not edit.

@smalruby3-editor-bot

Copy link
Copy Markdown
Author

🤖 敵対的レビュー(round 1): 指摘 3 件(Must 0 / Question 0 / FYI 3)

FYI

  • [FYI1] tools/autopilot/prompts/autopilot-*.md 同じ 4 行の箇条(reason を必ず書く・トークンが取れないときの書き方)が 8 つのプロンプトにそのまま複製されている。正は autonomous-contract.md §2.3 にあるので、各プロンプトは 1 行の参照だけでも足りる。 — 見送り: 隣の「questions を足す」の箇条も各プロンプトに同じ文で持つ形で、worker はプロンプトだけを読んで動くため、いまの形にそろえる
  • [FYI2] tools/autopilot/src/contract.js:162 validateResult は空白だけの reason(' ')を「空でない」として通すが、normalizeResult は空白だけを書き漏れとして summary で置きかえる。summary も空のときは空白だけの reason がそのまま通り、判定が 2 か所で少しずれている。 — 見送り: validateResult を trim で厳しくすると、いま通っている結果が Blocked になり振る舞いが変わる(この PR の狙いと逆向き)。実害は無い
  • [FYI3] tools/autopilot/prompts/ current-status / learnings / task / release-check / resolve-conflict の 5 つには箇条を足していない。確かめたところ、hitl を返さない(current-status・learnings)か、例に reason を書いている(task・resolve-conflict)か、done + hitl:true で返す(release-check)ので、足さなくてよい。書き漏れても normalizeResult が補う。 — 見送り: 情報共有のみ

直してほしい指摘は、モニターの「AI に直してもらう」で指示を書くか、Request changes で ID を指定してから 🙋 HITL を外してください(例: Q1はOK, FYI1は修正して)。ふつうのコメントだけでは autopilot は動きません。

@smalruby3-editor-bot smalruby3-editor-bot Bot added the 🙋 HITL 人間の対応待ち(Project HITL=Yes の投影) label Nov 29, 2026
@smalruby3-editor-bot
smalruby3-editor-bot Bot marked this pull request as ready for review November 29, 2026 00:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 autopilot autopilot が処理対象にした Issue/PR(daemon が付与) 🙋 HITL 人間の対応待ち(Project HITL=Yes の投影)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(autopilot): do not block a worker that returns hitl without a reason

0 participants