fix(plugin): port to OpenCode V2 session hooks
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- bun, typescript
調査の方向性
Start by locating the plugin's setup function and its compaction hook, then compare the callback shape with the OpenCode V2 contract described in the issue. Trace how session directories and the two configuration paths are resolved, and review the hook tests for deduplication, durable instructions, and error handling. Done means bun test passes and the isolated E2E checks in the issue succeed.
索引モデルが issue の本文から書いたものです。
説明
Problem
0.1.11 never re-injects AGENTS.md. It registers ctx.session.hook("compaction", ...) and mutates event.context / event.options.context / event.prompt. In OpenCode V2 (verified on 2.2.5) ctx.session.hook exists but the callback receives one mutable event with system, messages, and options — none of the mutated fields above, so the hook is a silent no-op.
Additionally, the V1-style setup() that returns a hooks object (instead of registering hooks and returning a cleanup function) can break plugin loading on a shared opencode serve.
Evidence
- V2 docs:
compactionruns for checkpoint summaries; inject context by pushing intoevent.system;contextruns before every agent model request. opencode plugin listand the binary contract:Expected plugin to have a non-empty name/setup() function.
Fix
compactionhook: push a bounded fullAGENTS.mdblock intoevent.systemso the summary preserves the mandates.contexthook: push a bounded digest every request and record a durable session instruction entry (session.instructions.entry.put, once per session) so the rules survive compaction.- Resolve
AGENTS.mdfrom the session directory upward, then~/.config/opencode/AGENTS.md, then~/.config/opencode/prompts/AGENTS.md. - Skip injection when the system prompt already carries the file (avoid duplication with native
instructions). - Wrap every hook in try/catch: a plugin failure must never break model resolution or a request.
- Unit tests for hooks, dedupe, durable entry, resolution and error swallowing.
Verification
bun test: 13 pass.- Isolated E2E (
OPENCODE_CONFIG_DIR,--standalone, mock OpenAI server): model answers; digest present on every request; full rules present in the compaction request; post-compaction request carries the digest.
- 主要言語
- TypeScript
- スター
- 0
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
似ている issue
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openclaw/openclaw#212827 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Use one constant for the 10,000-character input limit対応中かも @NginxL が今日担当しました。 オープンgood first issue refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
aniru-dh21/snap-validate#51 ·
メンテナーはふだん 1 日以内に返信
-
dependencies effort: small good first issue priority: low
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
TMHSDigital/screencast-mcp#509 ·
メンテナーはふだん 1 日以内に返信
-
from-review tech-debt testing
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
blamechris/chroxy#9520 ·
メンテナーはふだん 1 日以内に返信