[Bug]: ACP v2 plan replacements and removals lose their target between turns
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Start with apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts; the issue provides a deterministic regression test that passes for same-turn operations and fails across turns. Trace how ACP v2 plan IDs and removals are handled across turns in the adapter, then run the focused test with the repository's Vite+ test runner. Done when replacements reuse the session plan ID and removals emit a superseded update across turn boundaries.
索引モデルが issue の本文から書いたものです。
説明
Summary
An ACP agent cannot update or remove a previously reported plan after the next turn starts. T3 ignores the removal and creates another plan artifact for the replacement, leaving the earlier artifact unchanged. A deterministic adapter reproduction confirms that the same operations work within one turn and fail across turns.
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Run the script below against the stated checkout with its lockfile dependencies installed.
- In the control turn, create, replace and remove a plan with ID
control, then create planslater-removeandlater-replace. - In a second turn of the same session, send
plan_removedforlater-removeand a replacementplan_updateforlater-replace. - Compare emitted
plan.updatedevents across both turns.
The final portable reproduction returned RESULT: defect reproduced on its first run. An earlier focused adapter probe produced the same event counts and identity mismatch.
Save the following as repro-plan.sh and run sh repro-plan.sh /path/to/t3code. Prerequisites are Git, Python 3, Node compatible with the checkout, and the checkout’s installed lockfile dependencies including Vite+. The script prints tool versions, creates a disposable detached worktree and isolated HOME, TMPDIR and T3 state/cache directories, inserts one focused test into the existing adapter test fixture, and removes its worktree and inputs on exit. It launches only T3’s mock ACP peer. The control requires all three same-turn events to share one T3 plan ID, verifies that the replacement contains only the new entry, and verifies the removal becomes superseded. Exit 0 means expected behavior, 1 means the defect reproduced, and 2 means setup or the control was inconclusive.
Reproduction script: repro-plan.sh
#!/bin/sh
set -u
result=2
checkout=$(cd "${1:?Usage: sh repro.sh /path/to/t3code}" && pwd) || exit 2
scratch=$(mktemp -d) || exit 2
cleanup() {
git -C "$checkout" worktree remove --force "$scratch/wt" >/dev/null 2>&1 || :
rm -rf "$scratch"
}
trap cleanup EXIT HUP INT TERM
finish() {
case "$1" in
0) echo 'RESULT: expected behavior';;
1) echo 'RESULT: defect reproduced';;
*) echo 'RESULT: inconclusive';;
esac
exit "$1"
}
node --version || finish 2
python3 --version || finish 2
git --version || finish 2
"$checkout/node_modules/.bin/vp" --version || finish 2
git -C "$checkout" rev-parse HEAD || finish 2
mkdir -p "$scratch/home" "$scratch/tmp" "$scratch/state" || finish 2
export HOME="$scratch/home" TMPDIR="$scratch/tmp" T3CODE_HOME="$scratch/state"
export XDG_CACHE_HOME="$scratch/cache" XDG_CONFIG_HOME="$scratch/config"
export T3CODE_DEV_SEED=0
if ! git -C "$checkout" worktree add --detach "$scratch/wt" HEAD >"$scratch/setup.log" 2>&1; then finish 2; fi
cat > "$scratch/case.ts" <<'CASE'
it.live("g08 plan replacement and removal survive turn boundaries", () =>
Effect.gen(function* () {
const instanceId = ProviderInstanceId.make("g08-plans");
const threadId = ThreadId.make("g08-plans");
let notify: Parameters<AcpSessionRuntime.AcpSessionRuntime["Service"]["handleSessionUpdate"]>[0];
let ordinal = 0;
const adapter = yield* makeAcpAdapterV2({
instanceId,
selfInvocation: yield* resolveSelfInvocation(),
flavor: {
driver: ACP_TEST_DRIVER,
capabilities: AcpProviderCapabilitiesV2,
makeRuntime: makeMockRuntime({
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
mockAgentPath: yield* bundledMockAgentPath,
wrapRuntime: (runtime) => ({
...runtime,
handleSessionUpdate: (handler) => Effect.sync(() => { notify = handler; }).pipe(Effect.andThen(runtime.handleSessionUpdate(handler))),
prompt: () => Effect.gen(function* () {
ordinal++;
const send = (update: EffectAcpSchema.SessionUpdate) => notify({ sessionId: "mock-session-1", update });
const plan = (id: string, text: string) => send({ sessionUpdate: "plan_update", plan: { type: "items", planId: id, entries: [{ content: text, priority: "medium", status: "pending" }] } });
yield* send({ sessionUpdate: "state_update", state: "running" });
if (ordinal === 1) {
yield* plan("control", "First");
yield* plan("control", "Replacement");
yield* send({ sessionUpdate: "plan_removed", planId: "control" });
yield* plan("later-remove", "Remove on next turn");
yield* plan("later-replace", "Old contents");
} else {
yield* send({ sessionUpdate: "plan_removed", planId: "later-remove" });
yield* plan("later-replace", "New contents");
}
yield* send({ sessionUpdate: "state_update", state: "idle", stopReason: "end_turn" });
return { stopReason: "end_turn" as const };
}),
}),
}),
},
});
const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({ runtimeMode: "full-access", interactionMode: "default", cwd: process.cwd() });
const modelSelection = { instanceId, model: "default" } as const;
const runtime = yield* adapter.openSession({ threadId, providerSessionId: ProviderSessionId.make("g08-plans"), modelSelection, runtimePolicy });
const providerThread = yield* runtime.ensureThread({ threadId, modelSelection, runtimePolicy });
const now = yield* DateTime.now;
const run = (ordinal: number) => Effect.gen(function* () {
yield* runtime.startTurn(makeTurnInput({ threadId, providerThread, instanceId, runtimePolicy, now, ordinal }));
return Array.from(yield* runtime.events.pipe(Stream.takeUntil((event) => event.type === "turn.terminal"), Stream.runCollect)).flatMap((event) => event.type === "plan.updated" ? [event.plan] : []);
});
const first = yield* run(1);
assert.equal(first.length, 5);
assert.equal(first[0]!.id, first[1]!.id);
assert.equal(first[1]!.id, first[2]!.id);
assert.equal(first[1]!.kind, "todo_list");
assert.deepEqual(first[1]!.kind === "todo_list" ? first[1]!.steps.map((s) => s.text) : [], ["Replacement"]);
assert.equal(first[2]!.status, "superseded");
console.log("PLAN_CONTROL_OK same-turn replacement and removal");
const second = yield* run(2);
const removed = second.find((p) => p.id === first[3]!.id && p.status === "superseded");
const replacement = second.find((p) => p.kind === "todo_list" && p.steps.some((s) => s.text === "New contents"));
console.log("PLAN_OBSERVED", JSON.stringify({ firstTurnPlanEvents: first.length, secondTurnPlanEvents: second.length, removedPriorPlan: !!removed, reusedReplacedPlanId: replacement?.id === first[4]!.id }));
assert.isDefined(removed, "plan_removed on a later turn must supersede the existing session plan");
assert.equal(replacement?.id, first[4]!.id, "the same session plan must be replaced, not duplicated");
}).pipe(Effect.provide(layerTest), Effect.scoped),
);
CASE
python3 - "$checkout" "$scratch" <<'PYTHON'
from pathlib import Path
import os,sys
root=Path(sys.argv[1]); scratch=Path(sys.argv[2]); wt=scratch/'wt'
# Link dependencies individually so new runner caches stay in the disposable worktree.
for directory, dirs, files in os.walk(root):
dirs[:]=[d for d in dirs if d not in ('.git','.repos','.t3')]
if 'node_modules' not in dirs:
continue
dirs.remove('node_modules')
nm=Path(directory)/'node_modules'; target=wt/nm.relative_to(root)
target.mkdir(parents=True,exist_ok=True)
for entry in nm.iterdir():
(target/entry.name).symlink_to(entry,target_is_directory=entry.is_dir())
p=wt/'apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts'
s=p.read_text(); needle=' beforeAll(() => bundleAgents);'
if s.count(needle)!=1:
raise RuntimeError('test fixture insertion point changed')
p.write_text(s.replace(needle,needle+'\n'+(scratch/'case.ts').read_text(),1))
PYTHON
if [ "$?" -ne 0 ]; then finish 2; fi
cd "$scratch/wt" || finish 2
node_modules/.bin/vp test run apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts -t 'g08 plan' >"$scratch/test.log" 2>&1
status=$?
# The control must pass before a failing assertion can count as this defect.
python3 - "$scratch/test.log" <<'PYTHON'
import sys
for line in open(sys.argv[1]):
if line.startswith(('PLAN_CONTROL_OK','PLAN_OBSERVED')):
print(line.rstrip())
PYTHON
if ! grep -q 'PLAN_CONTROL_OK' "$scratch/test.log"; then finish 2; fi
if [ "$status" -eq 0 ]; then finish 0; fi
if grep -q 'plan_removed on a later turn must supersede' "$scratch/test.log"; then finish 1; fi
finish 2
Expected behavior
The same planId identifies one plan throughout an ACP session. A replacement must replace that plan’s contents, and plan_removed must target the previously reported plan regardless of a T3 turn boundary. The pinned upstream Agent Plan document, plan identity, removal, and replacement establish these contracts. The pinned schema, $defs.PlanId and $defs.PlanRemoved defines a session-scoped plan ID and the removal update; this does not rely on a later schema.
Actual behavior
The reproduction opens one ACP session, reports three identified plans during its first turn, then removes one plan and replaces another during the next turn. Same-turn replacement reuses the existing T3 plan ID, and same-turn removal emits superseded. Across turns, plan_removed emits no plan update, while the replacement is assigned a different T3 plan ID; the old artifacts receive no update.
Impact
Minor bug or occasional failure
Impact: P2 - Valid later-turn updates leave stale plan artifacts and duplicate plan identity in provider events, so consumers cannot maintain the agent’s current plan accurately.
The demonstrated scope is one still-open ACP v2 session across two user turns, with item-based plan content. Workaround: NOT_ENOUGH_INFO - no user-side workaround was tested. A real provider’s emission frequency and the appearance in web, desktop and mobile were not measured.
Version or commit
T3 Code commit 59e64eef881632a23f89c4138bcf37f23d92bf93. ACP wire version 2, pinned generated schema schema-v2.0.0-alpha.3. Repository dependencies were kept at their lockfile versions.
Environment
macOS 27.2, arm64; Node v26.12.1, Python 3.15.2, Git 2.56.0, Vite+ CLI 1.4.0, Vite+ test runner 5.0.5, Effect 4.1.3 from the checkout lockfile.
Logs or stack traces
The final script printed the following. No machine paths or private identifiers are included. The Vite+ CLI’s local-package lookup printed Not found from the invoking scratch directory; the actual focused test runner resolved and ran successfully, as established by the control and observation markers.
v26.12.1
Python 3.15.2
git version 2.56.0
vp v1.4.0
Local vite-plus:
vite-plus Not found
59e64eef881632a23f89c4138bcf37f23d92bf93
PLAN_CONTROL_OK same-turn replacement and removal
PLAN_OBSERVED {"firstTurnPlanEvents":5,"secondTurnPlanEvents":1,"removedPriorPlan":false,"reusedReplacedPlanId":false}
RESULT: defect reproduced
The runtime parser forwards identified plan updates and removals at packages/provider-acp/src/server/runtimeModel.ts#L1438-L1498. The adapter looks for a removal target only in context.plans and returns when absent at packages/provider-acp/src/server/adapter.ts#L4476-L4484; replacement allocates a fresh artifact when that map has no prior entry at packages/provider-acp/src/server/adapter.ts#L4488-L4504. Each new turn initializes plans: new Map() at packages/provider-acp/src/server/adapter.ts#L8376-L8381. These source paths explain the event stream observed through makeAcpAdapterV2 → openSession → ensureThread → startTurn.
Restoration check
The control remains green, later-turn removal updates the original plan to superseded, and later-turn replacement updates the original plan artifact without leaving its previous contents active.
Workaround
No user-side workaround was verified.
Additional interface context
API: ACP session/update, projected through the shared provider adapter into orchestration events.
Earliest failure stage: State or storage
- 主要言語
- TypeScript
- スター
- 24.8k
- フォーク
- 6.4k
- 平均マージ
- 59分
- マージ済み PR(30日)
- 418
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pingdotgg/t3code のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
via-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Question card options show LaTeX as raw source, though the question text renders it対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Settings inheritance popover shows raw slugs for branch naming, default permissions and response streaming対応中かも @juliusmarminge が 1 日前に担当しました。 オープンvouch:denounced
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
pingdotgg/t3code の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nikoheikkila/nikoheikkila.fi#1131 ·
メンテナーはふだん 1 日以内に返信
-
Resources: Update work of urumqi対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
railmapgen/rmp-gallery#4176 ·
メンテナーはふだん 2 日以内に返信
-
GraphQL custom headers duplicate differently cased default headers対応中かも @yxr-2025 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
elie222/rakazo#4625 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[New Project]: Pacaオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
github/forgoodfirstissue#574 ·