You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
V2: repeated valid system messages reject the entire context projection #422
Lower two valid projected system messages with distinct IDs and identical text using official toLLMMessages. OpenCode emits two Message.system(text) values without IDs. Pass the projected and lowered arrays to ACP normalizeV2ProjectedHistory.
Actual: valid: false, System source s1 has multiple lowered origins.
The same diagnostic repeated in a real long-lived session immediately after activation of the #418 fix. Therefore the subsequent tool failures were not established to be solely a plugin-reload problem.
Root cause
lib/v2/projection/normalize.ts:661-673 correlates system sources by text and rejects more than one identical unclaimed candidate. Official OpenCode packages/core/src/session/runner/to-llm-message.ts lowers system messages without preserving their IDs. Repeated instruction text is a valid host sequence.
Impact / fix direction
One repeated system text rejects the complete ACP context projection, skips pruning/ID/nudge injection, and prevents fresh initialization from committing. Use a verified ordered occurrence mapping where possible; otherwise preserve ambiguous system objects as opaque while processing independently correlated messages. Do not guess ownership or remove system messages.
Acceptance: genuine host-lowered repeated identical system messages, interleaved histories, extra host-added system messages, and rejection of truly ambiguous destructive edits. Assert a fresh registry commits and valid direct compression affects the following request.
Root cause.lib/v2/projection/normalize.ts correlated projected system sources to their lowered outgoing messages by text, and rejected the whole projection whenever one system text had more than one unclaimed candidate. But OpenCode's lowering emits system messages without preserving IDs, so N identical projected records legitimately produce N identical ID-less lowered messages. A single repeated instruction text therefore rejected the entire projection — skipping pruning / message-ID / nudge injection and preventing a fresh session from ever committing state.
Fix. Correlate by ordered occurrence instead of rejecting: reuse the existing greedy outgoingSystem() claiming helper so the k-th projected record maps to the k-th unclaimed lowered match. Unmatched records stay opaque/unmapped; ownership is never guessed and no system message is dropped. All non-system rejections are unchanged (the fail-closed guard for genuinely ambiguous destructive edits is preserved).
Verification.
tsc --noEmit clean · npm run build success.
Full suite green except one pre-existing, environment-only failure in tests/soft-block.test.ts (it hardcodes a temp directory that isn't writable in this sandbox). Unrelated to this change — not in the diff — and passes in CI.
New tests added for every acceptance criterion: repeated identical system text, interleaved histories, extra host-added system messages, rejection of truly ambiguous patchable sources (regression guard), and — end-to-end — that a fresh registry commits and a valid direct compression affects the following request. The key tests were verified to fail on the reverted buggy code and pass with the fix.
Commit:ec3ada23 on branch 2026-09-17_v2-repeated-system-text (5 files, +378/−11).
⚠️ Blocked on opening the PR (needs you)
The established home for these V2 fixes is drexb-ops/opencode-acp — the sibling V2 fixes all landed there as same-repo PRs (e.g. #2 “preserve opaque V2 compaction sources”, #3 “recognize failed V2 ACP tool results”). But:
The daemon credential here is ranxianglei, which is read-only (push:false) on drexb-ops/opencode-acp — direct push is denied.
ranxianglei/opencode-acp has no branch matching the V2 base commit (1fe36e09), so a clean-diff PR can’t be opened there either (targeting master would drag in the entire lib/v2/ tree, which violates diff-cleanliness rules).
Tell me the intended PR target and I’ll follow it.
As a safety net (we just recovered from an incident that lost in-flight work), I’ve already pushed the branch to ranxianglei/opencode-acp@2026-09-17_v2-repeated-system-text (ec3ada23) so nothing is lost and the diff is immediately inspectable. I deliberately did not open a PR there since it has no valid base.
Activity
ranxianglei commentedon Sep 17, 2026
继续
ranxianglei commentedon Sep 17, 2026
状态 / Status — ✅ #422 的原始请求已完成并验证(修复 + 测试 + devlog,提交
ec3ada23);仅剩“开 PR”这一步因权限受阻,需要你处理。详见下方。Fix complete & verified
Root cause.
lib/v2/projection/normalize.tscorrelated projected system sources to their lowered outgoing messages by text, and rejected the whole projection whenever one system text had more than one unclaimed candidate. But OpenCode's lowering emits system messages without preserving IDs, so N identical projected records legitimately produce N identical ID-less lowered messages. A single repeated instruction text therefore rejected the entire projection — skipping pruning / message-ID / nudge injection and preventing a fresh session from ever committing state.Fix. Correlate by ordered occurrence instead of rejecting: reuse the existing greedy
outgoingSystem()claiming helper so the k-th projected record maps to the k-th unclaimed lowered match. Unmatched records stay opaque/unmapped; ownership is never guessed and no system message is dropped. All non-system rejections are unchanged (the fail-closed guard for genuinely ambiguous destructive edits is preserved).Verification.
tsc --noEmitclean ·npm run buildsuccess.tests/soft-block.test.ts(it hardcodes a temp directory that isn't writable in this sandbox). Unrelated to this change — not in the diff — and passes in CI.devlog/2026-09-17_v2-repeated-system-text/{REQ,WORKLOG}.md.Commit:
ec3ada23on branch2026-09-17_v2-repeated-system-text(5 files, +378/−11).The established home for these V2 fixes is
drexb-ops/opencode-acp— the sibling V2 fixes all landed there as same-repo PRs (e.g. #2 “preserve opaque V2 compaction sources”, #3 “recognize failed V2 ACP tool results”). But:ranxianglei, which is read-only (push:false) ondrexb-ops/opencode-acp— direct push is denied.ranxianglei/opencode-acphas no branch matching the V2 base commit (1fe36e09), so a clean-diff PR can’t be opened there either (targetingmasterwould drag in the entirelib/v2/tree, which violates diff-cleanliness rules).To unblock, either:
ranxiangleipush access todrexb-ops/opencode-acp— I’ll push the branch there and open the PR (basemaster, body referencing Closes V2: repeated valid system messages reject the entire context projection #422); orAs a safety net (we just recovered from an incident that lost in-flight work), I’ve already pushed the branch to
ranxianglei/opencode-acp@2026-09-17_v2-repeated-system-text(ec3ada23) so nothing is lost and the diff is immediately inspectable. I deliberately did not open a PR there since it has no valid base.一句话:#422 “重复 system 文本导致整份投影被拒”的 bug 已按“出现顺序映射而非拒绝”修好并通过全部相关测试(含失败复现验证),提交在
ec3ada23;只差开 PR——当前凭据对目标仓库drexb-ops/opencode-acp只有只读权限,请授予 push 或指定其它目标后即可合入。ranxianglei commentedon Sep 17, 2026
✅ 已按“继续”推进完成 —— 修复已提交并开出 PR:#429
PR #429
fix(v2): map repeated identical system text by ordered occurrence— 干净的 5 文件 diff(1 commit, +378/−11),关联本 issue(Fixes #422)。关于目标仓库的说明:此修复属于 V2 双运行时线,该线目前在
drexb-ops/opencode-acp(同批 #2/#3 都落在那)。但本会话凭据ranxianglei对drexb-ops只有只读权限(已再次确认push:false)。为了能立刻给你一个可评审的产物,我把 PR 开在 issue 所在的ranxianglei/opencode-acp,基线用一个钉在 V2 tip 的分支2026-09-17_v2-base(=1fe36e09),从而保证 diff 只含本次 5 个文件、不把整个lib/v2/拖进来。如果你更希望它落在
drexb-ops/opencode-acp:授予ranxianglei对该仓库 push(或直接拉取分支2026-09-17_v2-repeated-system-text/ commitec3ada23),我就在那边重开。PR 与分支均已持久化,不会丢失。验证:
tsc --noEmit干净 · build 成功 · 全量测试通过(仅tests/soft-block.test.ts一处为沙箱临时目录不可写导致的环境性失败,与本改动无关、不在 diff 内、CI 可过);关键测试已在回退到旧 bug 代码时确认会失败、加回修复后通过。devlog 见devlog/2026-09-17_v2-repeated-system-text/。一句话:#422 重复 system 文本导致整份投影被拒的 bug 已修好并通过测试,PR 已开(#429,基于钉住的 V2 基线以保证干净 diff);若需改投 drexb-ops,请授予 push 或指定目标即可。
test(v2): assert provider-owned state of unclaimed host system messages
ranxianglei commentedon Sep 19, 2026
opencodeV2 use https://github.com/ranxianglei/billion-context