Skip to content

fix(local): wrapper固定worktree削除を防止 - #270

Merged
terisuke merged 1 commit into
devfrom
fix/local-wrapper-pinned-worktree-guard-20260701
Jul 1, 2026
Merged

terisuke merged 1 commit into
devfrom
fix/local-wrapper-pinned-worktree-guard-20260701

Conversation

@terisuke

@terisuke terisuke commented Jul 1, 2026

Copy link
Copy Markdown

① なぜ

~/.local/bin/opencode-live-guardrails-wrapper は local deploy 元 worktree 内の built binary と guardrails wrapper を固定参照します。

その worktree を cleanup で削除すると、Git 上の cleanup は正しくても local opencode 起動が壊れます。これまでは削除前に wrapper を人間が読む運用に寄っており、再発防止として不十分でした。

Closes #269

② どう実装したか

  • scripts/local-dev-deploy.sh で wrapper 固定先 manifest opencode-live-guardrails-wrapper.json を生成
  • bun run local:assert-not-pinned -- <worktree-path> を追加し、削除対象 worktree が wrapper の固定先なら失敗
  • manifest が stale な場合も wrapper 本文と entrypoint symlink を確認して fail-safe 化
  • local:check に manifest 照合を追加
  • AGENTS.md に worktree 削除前の必須手順を明文化
  • local deploy smoke に manifest / pinned rejection / stale manifest / entrypoint symlink の回帰テストを追加

③ レビューしてほしい点

  • cleanup 時の削除拒否条件が過剰に緩くないか
  • manifest が stale / missing のときも危険側に倒れているか
  • 既存の local:deploy / local:fix / local:check の運用を壊していないか

④ テスト・確認方法

  • bash -n scripts/local-dev-deploy.sh
  • git diff --check
  • packages/opencode: bun typecheck
  • packages/opencode: bun run test:httpapi
  • repo root: bun run local:deploy
  • repo root: bun run local:check
  • ~/.local/bin/opencode --version
  • tmp dir: ~/.local/bin/opencode debug info
  • packages/opencode: bun test --timeout 30000 test/cli/smokes/local-deploy.test.ts
  • bun run local:assert-not-pinned -- <current-pinned-worktree> が block すること
  • bun run local:assert-not-pinned -- <tmpdir> が pass すること
  • deployed entrypoint 経由の TUI 起動 smoke

ローカルentrypointはdeploy元worktree内のbinaryとguardrailsを固定参照するため、cleanupでそのworktreeを削除すると起動不能になる。

削除前に固定先を検出できるmanifestとassertコマンドを追加し、運用手順もAGENTSに残して再発を防ぐ。

Closes #269
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

The following comment was made by an LLM, it may be inaccurate:

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: local wrapper固定worktree削除の事故を防止

1 participant