Repository navigation
Conversation
acpx drives opencode, and opencode is on both default ladders, so every analysis and synthesis call backpass makes through it is filed in the opencode store under the repo's cwd - a tier-1 exact match on the next run. Self-session detection only reads transcript files, and an opencode store is one SQLite database, so three things went wrong: - The file-head check read the database's first 256 KiB. Its pages hold every session's text, so a backpass prompt stored near the start of the file marked every session in the store as backpass's own, and a prompt stored further in was missed. - With the head check unable to see them, backpass's own opencode sessions were analyzed as corpus - backpass auditing itself, which the self-session sentinel exists to prevent. - Each agent probe (`acpx opencode sessions new`) leaves an empty session under the repo's cwd, which was listed and matched at tier 1. The opencode listing query now reads each session's first user text part, the part an acpx prompt lands in, and marks the row `self` when it opens with the sentinel; discovery drops those rows and counts them in SELF. A session with no user text at all recorded nothing and is not listed. Discovery never reads a SQLite database as a transcript head. The new cases in `test/self-session.test.js` put a genuine session, a self session and a probe's empty session in one small opencode store; they fail on all three counts before this change.
…cally and remotely
…xcluding empty probes
…ery safety documentation
…cks the first user message, preserving attachment-opening conversations and their descendants when later messages quote backpass prompts. Remote probes respect the adapter's explicit classification. Self ancestry is computed once per discovery instead of querying ancestors per child. Both regressions failed before the fixes and pass afterward. Verification passed: 103 relevant tests, targeted ESLint and Prettier checks, TypeScript checking, and git diff --check. The hosted Greptile check was not rerun in this phase
OpenCode 2 no longer writes `session`, `message` and `part`. Its store keeps each session in `session_v2` and the whole history as one typed row per message in `session_message`. On a 2.x-only store the adapter's listing query failed with `no such table: session`, so the harness was skipped with a warning and none of those sessions could be analyzed. The adapter now reads both layouts from the one database: - Listing reads `session_v2`, and dates a session by its newest message: `session_v2.time_updated` does not move as messages arrive, so a session resumed today was otherwise outside every window. - An in-place upgrade copies each 1.x session into `session_v2` under the same id and leaves the 1.x tables behind; a session in both is listed once and read from `session_v2`, where it continues. A store with neither table is reported as drifted instead of read as empty. - Reading maps each message type deliberately. User and assistant turns keep their text, and tool calls stay in the order the model made them, with their text output or error message as the result. Text the harness injected - instruction files (the memory file itself), continue notices, system notices, and compaction summaries of turns still stored above them - never becomes a turn. A background subagent or shell reports back in an injected message; that completion becomes the result of the call that started the job. A shell command or skill the person ran from the prompt is kept as a call. - A 2.x session follows the same rules as a 1.x one: it is backpass's own when its first user message opens with the self-session sentinel or it descends from such a session, and it is not listed when it has no messages at all. Golden fixtures pin both layouts: `test/fixtures/opencode-v2-store.json` and `opencode-v1-store.json` carry the DDL of real 2.0.18 and 1.18.32 stores and rows modeled field-for-field on real ones.
…temporary test homes
|
…easured "1 sqlite query" claim with "sqlite store" at the shared OpenCode/Hermes rendering boundary. Reproduced the incorrect rendered output before fixing it. Updated rendering tests to cover both harnesses at three terminal widths while preserving session counts. All 23 rendering tests, targeted ESLint and Prettier checks, and git diff --check pass. Discovery behavior is unchanged
Owner
|
Speaking as Kun's firstmate: closing as subsumed. Tip vs main for the OpenCode 2 store reader + self/descendant exclusion landed via squash-merge of stacked #181 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Stacked on #174 (backpass own OpenCode sessions). OpenCode 2 no longer writes the session, message and part tables; its store keeps sessions in session_v2 and the whole history as one typed row per message in session_message, so on an OpenCode 2 store the opencode adapter failed with no such table: session and every session was skipped. Read both layouts from one database: list session_v2 dated by its newest message (session_v2.time_updated does not move), read a session found in both layouts from session_v2 after an in-place upgrade, report a store with neither table as drifted, and map each 2.x message type deliberately (user and assistant turns, tool calls in order with text output or error, background subagent and shell completions as the result of the call that started them, user shell commands and skills as calls; instruction files, continue notices, system notices and compaction summaries never become turns). Apply the same self-session, delegated-descendant and empty-session rules as 1.x. Pin both layouts with golden fixtures built from the real 2.0.18 and 1.18.32 DDL.
What Changed
session_v2, use newest-message activity for discovery, and report unrecognized stores.Risk Assessment
✅ Low: The change is limited to one read-only discovery adapter and meets every intent requirement: both layouts, dating by newest message, v2 preferred for upgraded sessions, drift reporting, deliberate message-type mapping, the same self, descendant and empty-session rules, and golden fixtures; the only findings are an unrequired fallback and minor cleanups.
Testing
Focused OpenCode tests and all seven live scenarios passed after correcting a disposable database-builder setup error; baseline reproduction, CLI transcripts, and fetched protocol payloads were saved, and temporary data was removed. No graphical UI changed, so evidence is CLI/protocol output rather than screenshots.
Evidence: Validation report with linked product evidence
Evidence: Baseline OpenCode 2 failure
Evidence: Successful OpenCode 2 CLI scan
Evidence: Fetched OpenCode 2 turns and tool results
Evidence: Fetched histories from the upgraded mixed-layout store
~/.no-mistakes/evidence/01M3PBHV5RSAV96NQ138KWHJFA/guards-v2-1d.txt)Evidence: Human-readable schema-drift warning
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
src/discovery/adapters/opencode.js:218- The fallback inlayoutOfaccepts a ref withoutextra.layoutand looks upsession_v2to choose a layout. Nothing in the product produces such a ref. Local discovery (sessionRow) and remote discovery always attachextra.layout. The remote probe also sends it:descriptorFromandfetchHostin src/discovery/remote/probe.js and src/discovery/hosts.js pass it throughrow.extra. No persisted state stores OpenCode refs across releases. The only callers that pass a bare{ id }are tests (test/adapters.test.js 'a ref recorded before the layout was' and test/self-session.test.jsread({ id })). The intent does not require reading layout-less refs. Suggested fix: remove the lookup and treat a missing layout asv1, the only layout that existed before this change. Update the v2 test to read through a discovered row.src/discovery/adapters/opencode.js:167- InlistV2,recorded(an EXISTS subquery) always equalsmessage_time IS NOT NULL, becauseMAX(time_updated)over the same rows is NULL exactly when there are none. Derivingrecordedfrommessage_timeremoves one correlated subquery per session on every discovery, and behavior stays the same.test/adapters.test.js:843-withOpencodeHomecreates a temp HOME withmkdtempSyncand never deletes it, so each run of the five new OpenCode tests leaves a directory in the system temp dir. Also, whenHOMEwas originally unset, the restore setsprocess.env.HOMEto the string "undefined" instead of deleting it. Fix: in thefinally, callfs.rmSync(homeDir, { recursive: true, force: true })and deleteHOMEwhenpreviousis undefined.🔧 Fix applied.
5 issues (3 warnings, 2 infos) still open:
src/discovery/adapters/opencode.js:218- The fallback inlayoutOfaccepts a ref withoutextra.layoutand looks upsession_v2to choose a layout. Nothing in the product produces such a ref. Local discovery (sessionRow) and remote discovery always attachextra.layout. The remote probe also sends it:descriptorFromandfetchHostin src/discovery/remote/probe.js and src/discovery/hosts.js pass it throughrow.extra. No persisted state stores OpenCode refs across releases. The only callers that pass a bare{ id }are tests (test/adapters.test.js 'a ref recorded before the layout was' and test/self-session.test.jsread({ id })). The intent does not require reading layout-less refs. Suggested fix: remove the lookup and treat a missing layout asv1, the only layout that existed before this change. Update the v2 test to read through a discovered row.src/discovery/adapters/opencode.js:167- InlistV2,recorded(an EXISTS subquery) always equalsmessage_time IS NOT NULL, becauseMAX(time_updated)over the same rows is NULL exactly when there are none. Derivingrecordedfrommessage_timeremoves one correlated subquery per session on every discovery, and behavior stays the same.test/adapters.test.js:843-withOpencodeHomecreates a temp HOME withmkdtempSyncand never deletes it, so each run of the five new OpenCode tests leaves a directory in the system temp dir. Also, whenHOMEwas originally unset, the restore setsprocess.env.HOMEto the string "undefined" instead of deleting it. Fix: in thefinally, callfs.rmSync(homeDir, { recursive: true, force: true })and deleteHOMEwhenpreviousis undefined.src/discovery/adapters/opencode.js:219- This is the Round 1 finding. It was left unselected and is still present.layoutOfaccepts a ref that has noextra.layout, then looks the id up insession_v2to choose a layout. Nothing in the product produces such a ref. Local discovery always attachesextra.layout(sessionRow, line 196). Remote discovery does too, becausedescriptorFromin src/discovery/remote/probe.js reads the discovered row. No persisted state keeps OpenCode refs across releases. The only callers that pass a bare{ id }are tests: test/adapters.test.js ('a ref recorded before the layout was is looked up the same way') and test/self-session.test.js (read({ id })). No requirement in the intent needs layout-less refs to be read. Recommended remedy: remove the lookup and treat a missing layout asv1, the only layout that existed before this change. Change the v2 test to read through a discovered row.test/adapters.test.js:858- The Round 1 fix round (commit 12e6d91) added a 30-line test, 'opencode test homes are removed and HOME restored on success and failure'. It tests the test helperwithOpencodeHome, not product behavior. The finding it addressed (test-home-tempdir-leak) only asked forfs.rmSyncof the temp home and for deletingHOMEwhen it was originally unset. The helper change at lines 843-857 already does both. The meta-test goes beyond that finding and beyond the intent. It also mutatesprocess.env.HOMEacross six iterations, which adds fragility to the shared test file. Recommended remedy: keep the minimal helper fix and remove the meta-test.✅ **Test** - passed
✅ No issues found.
HOME="$PWD/.opencode-validation/test-home" XDG_CONFIG_HOME="$PWD/.opencode-validation/test-home/.config" TMPDIR="$PWD/.opencode-validation/tmp" GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null node --test --test-name-pattern='[Oo]pen[Cc]ode' test/adapters.test.js test/self-session.test.jsgit archive ddf8a7b06a9d191ee696d2ae9a10683c8b1ca872 src bin package.json | tar -x -C .opencode-validation/basefollowed by the baseline CLI scan reproducedno such table: session.node ~/.no-mistakes/evidence/01M3PBHV5RSAV96NQ138KWHJFA/opencode-live.mjsexercised isolated databases through the real CLI and production shipped-probe discovery/fetch protocol.Repeatedscan --harness opencode --host none --since all|1d --strict --jsonagainst both layouts, upgraded stores, adversarial session data, and a drifted schema; inspected saved CLI output and fetched transcript payloads.rm -rf .opencode-validation; git status --shortremoved disposable data and confirmed no worktree changes.src/tui/render.js:342- The completed OpenCode collection row still displays "1 sqlite query", but discovery now queries each available layout and performs schema checks. Replace the numeric claim with "sqlite store" in a follow-up. Left unchanged because this phase permits documentation and mechanical lint fixes, not runtime presentation changes.🔧 No changes applied.
1 info still open:
src/tui/render.js:342- The approved label correction remains blocked by this phase's scope: replacing "1 sqlite query" with "sqlite store" requires a runtime presentation edit and updating test/tui-render.test.js:234, which explicitly expects the old label. This phase prohibits both runtime behavior and test changes. The outer executor must route the approved fix to an authorized phase. Documentation, targeted ESLint and Prettier checks, and TypeScript checking otherwise pass.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.