Skip to content

fix(opencode): no commands after an uninstall and a restart - #1291

Open
vz-ibm wants to merge 8 commits into
mainfrom
fix/1290-opencode-gone-after-uninstall
Open

vz-ibm wants to merge 8 commits into
mainfrom
fix/1290-opencode-gone-after-uninstall

Conversation

@vz-ibm

@vz-ibm vz-ibm commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Behavior change (decided by the owner, @vz-ibm: the v0.7.6 QA run, updated 2026-11-25)

  • Who: OpenCode users who run /context-guru-uninstall in a project.
  • Old: after an OpenCode restart, all six /context-guru- commands and both ctrl+p entries stayed. /context-guru-status still answered and never said "uninstalled". In the session of the uninstall, update, preset and strategy still changed things.
  • New:
    • After an uninstall and a restart, the project has only /context-guru-install ("Turn context-guru on again in this project"), in OpenCode 1 and 2. The other 5 commands and the ctrl+p entries are gone. Other projects are not changed. (2026-11-25: the owner changed "no command" to "keep the way back".)
    • In the same session, before a restart: OpenCode cannot drop commands it already loaded. There, update, preset and strategy change nothing: they print enabled=no and the way back, as the Pi package does. /context-guru-status prints enabled=no.
    • A command whose script is gone (after --purge, or after the installer removed the state folder) says "uninstalled" instead of a shell error.
    • Full removal from OpenCode stays in the terminal only: the installer with -s uninstall (owner decision, 2026-11-25).
  • Way back: /context-guru-install in that project, then restart OpenCode.
  • How to turn the change off: no switch.

Summary

The owner expected that after uninstall and a restart, context-guru is no longer visible in OpenCode. v0.7.6 kept the commands, because the plugin registered them before it checked the disabled marker.

Fixes #1290

What changed

  • opencode-plugin/index.js:
    • The OpenCode 1 config hook and setupV2 check the disabled marker first. With the marker, they rewrite only the context-guru-install script (so the script that the log line names always exists, also after --purge), register only /context-guru-install, log the line once, and return. Routing stays off.
    • New exported isDisabled(state) and uninstalledNote().
    • The status script prints enabled=yes or enabled=no with the note. The status command text tells the agent to report "uninstalled" first.
    • The update, preset and strategy scripts stop at the marker: they print enabled=no and the way back, and change nothing. Every command text but status tells the agent to stop at enabled=no.
    • A command whose script is gone prints enabled=no and a note, not a shell error.
    • The uninstall output says that only /context-guru-install is left after a restart, and names the way back.
  • opencode-plugin/tui.js: registers no ctrl+p entry for a disabled project. In the session of an uninstall, the pickers show the uninstalled note and open no dialog. A missing script without the marker keeps the old "No ... script found" toast (first start).
  • opencode-plugin/test/disabled.test.mjs (new): 13 tests, port range 10100.
  • opencode-plugin/test/tui.test.mjs: 2 new tests for the pickers after an uninstall.
  • opencode-plugin/test/commands.test.mjs, opencode-plugin/test/v2.test.mjs: two tests that pinned the old behavior now expect only the install command (changed on purpose).
  • opencode-plugin/README.md, docs/how-to/install-opencode-plugin.md: a section "After an uninstall and a restart", with /context-guru-install as the way back. The sentence "The next OpenCode start writes the command scripts again" is removed, because it is no longer true.

Data dependence

None. The change reads only the disabled marker file.

How it was tested

  • node --test opencode-plugin/test/*.test.mjs: 131 pass, 0 fail, 4 skipped (the 4 timing tests, which need CG_TIMING_TESTS=1). 113 passed before the PR.
  • Each new test of the change failed first. Examples: six commands registered where only the install command was expected (OpenCode 1, OpenCode 2), one TUI layer registered, no enabled= line in status, and the "No preset script found" toast in the session of an uninstall.
  • The cycle test: the real uninstall script stops a stub proxy. A new start registers only /context-guru-install. The block from that command's template, run in a plain shell, prints result=re-enabled. The next start registers all six.
  • Real OpenCode: the owner tested uninstall, restart and the way back on OpenCode 1.19.5 and 1.19.6 (comments of 2026-11-23 and 2026-11-25). The ctrl+p palette is not tested in a real TUI (it needs a person).

Assisted-By: Claude (Anthropic AI) [email protected]

Local tests: waived (owner rule)

Behavior change, approved by the owner during the v0.7.6 QA run:
- Old: after /context-guru-uninstall and an OpenCode restart, all six
  /context-guru- commands and the two ctrl+p entries stayed.
- New: a start with the project's disabled marker registers no chat
  command (OpenCode 1 and 2) and no ctrl+p entry. It logs one line with
  the way back: sh <state>/context-guru-install, then restart OpenCode.
- Before the restart, /context-guru-status prints enabled=no and a note
  that context-guru is uninstalled; the status text tells the agent to
  say so. Without the marker it prints enabled=yes.
- The uninstall output, the plugin README and the how-to explain the way
  back.

Fixes #1290

Signed-off-by: Vitaly Zabershinsky <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (claude, user of @vz-ibm) Claude Code 2.1.325 offload-review skill, @vz-ibm's session fresh 2 of 2 1 of 2 230a34f27341 approve

Verdict: approve

Findings

None.

Non-blocking

  • opencode-plugin/index.js:576 and :830 — two texts still name /context-guru-install as the undo, with no restart limit.
    • The uninstall script prints undo=/context-guru-install. The uninstall outro tells the agent to say "/context-guru-install undoes this". The plan-phase note at :544 says the same.
    • These are true only until the next OpenCode restart. After it, the command does not exist.
    • The new note at :575 gives the correct way back, so the agent has the correct fact. But the agent can repeat the old text. Consider: "/context-guru-install in this session, or sh <state>/context-guru-install after a restart".
  • opencode-plugin/index.js:332 — the path in the way-back line has no quotes.
    • sh /Users/First Last/.local/state/... breaks when the home path has a space.
    • The apply=sh $STATE/... line at :543 has the same form, so this follows the current style. A rare case.
  • opencode-plugin/index.js:1295-1302 — no test drives the catch path of disabledStart.
    • When the write fails, the code only logs the line. This is fail-open and safe. A test with a read-only state directory would pin it. Small value.
  • Data dependence. The PR says "None", which is correct: the change reads only the disabled marker. docs/data-dependence/features/opencode-fallback.md already covers that marker. No row edit is necessary, in my view. The PR could say that in one line.
  • Not yet run in a real OpenCode TUI. The PR says so. The hooks are checked only with mocks. The real check before merge is important for the tui.js path, because the fake TUI API in the test is small.

What I checked

  • Read the full diff (7 files, +248/-14) and the code around each change: statusScript, installScript, uninstallScript, writeCommandScripts, registerCommands, safeLog, ContextGuruPlugin, setupV2, stateDirectory/stateRoot, tui.js.
  • Order of checks. The OpenCode 1 config hook and setupV2 now check the marker before they register commands or write scripts. Before, both registered commands first. Routing in the disabled case is the same as before: no routeProviders, no startProxy, no session hook, routedIds stays empty, so chat.headers does nothing.
  • Fail open. isDisabled is existsSync and does not throw. disabledStart catches the write error. safeLog catches log errors. The v2 console.log does not throw. No request path changes.
  • The way back works after --purge. The marker stays, so the state directory exists and writeAtomic can write context-guru-install. The install script removes the marker first, then prints result=never-installed when install.env is gone. After a plain uninstall, it finds context-guru-start and starts the proxy. The next start registers the commands again (cycle test, disabled.test.mjs:160-180).
  • Status script. uninstalledNote("$STATE") gives $STATE/context-guru-install inside double quotes, and STATE is shQuoted. So the shell expands it safely. enabled= comes before install=; --stats output was already mixed key=value lines, so the parse does not change.
  • Who writes disabled. Only the uninstall script (index.js:556). No other path can hide the commands by mistake.
  • Tests. 8 new tests, each with a negative pair (with and without the marker) for OpenCode 1, OpenCode 2 and the TUI. Port range 10100 does not overlap the other files (9000-9900). The two changed old tests (commands.test.mjs:163, v2.test.mjs:156) changed on purpose and the PR says so. Their other assertions (providers untouched, no hooks, install script exists) stay.
  • Behavior change rule. The PR names the change at the top: who, old, new, way back, and "no switch". It says the owner decided it. I did not check that decision outside the PR text.
  • Docs. README and the how-to match the code. The removed sentence ("The next OpenCode start writes the command scripts again") is now false, so removing it is correct.
  • I did not run the tests. Live tests are not approved for this review.

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (claude, user of @vz-ibm) Claude Code 2.1.325 offload-review skill, @vz-ibm's session fresh 1 of 2 1 of 2 230a34f27341 approve

Verdict: approve

Findings

None.

Non-blocking

  • opencode-plugin/index.js:58 — the way-back command is not shell-quoted. uninstalledNote prints run: sh <path>/context-guru-install with the raw path. The uninstall note at index.js:584 does the same with $STATE. If HOME, XDG_STATE_HOME or CONTEXT_GURU_STATE has a space, a user who copies the line gets sh: <first word>: No such file. The default root (~/.local/state/context-guru-opencode/<hash>) has no space, so most users are not affected. Fix: quote the path in the note (shQuote in the JS note; '$STATE/...' style in the scripts). The test regexes would need the same change.
  • The new uninstall note= line (index.js:584) has no test. The cycle test checks only result=uninstalled. A one-line assert.match on the new note would guard it.
  • Run from a shell, the install script starts the proxy with that shell's environment. Before, /context-guru-install ran inside OpenCode. Now the docs tell users to run it from any shell, so context-guru-start inherits the user's terminal environment, not OpenCode's. startScript uses setsid/nohup, so the proxy outlives the shell. The stub test passes with only PATH and HOME. I found no environment variable that the start relies on. This is a note for the real-OpenCode check, not a defect.
  • The PR says that it was not run in a real OpenCode TUI yet. The behavior depends on OpenCode reading the config hook, command.transform and the TUI keymap layer only at start. Please confirm in a real session before merge, as the PR plans.

What I checked

  • Read the full diff (7 files, 248+/14-) and the code around each change: stateRoot/stateDirectory, installScript, statusScript, uninstallScript, startScript, writeCommandScripts, registerCommands, ensureProxyRunning, the v1 config and chat.headers hooks, setupV2, and tui.js.
  • Behavior change permission. The PR names who is affected, the old and new behavior, and "no switch". Issue #1290 has a comment by @vz-ibm with "Expected behavior, decided by the owner". The PR matches that proposal point by point: no command at start, one log line, status says uninstalled in the same session, docs and uninstall message updated, cycle test.
  • Fail open. isDisabled is existsSync and does not throw. disabledStart catches a failed writeAtomic and uses safeLog (v1) or console.log (v2), so a disabled start cannot break OpenCode. With the marker, v1 returns before routing, so routedIds stays empty and chat.headers does nothing. v2 returns before provider.transform, so no http.request hook is registered. Requests go straight to the provider, as before.
  • The way back exists after --purge. Purge keeps the disabled marker and context-guru-install, and disabledStart rewrites context-guru-install at each start. The state folder exists because the marker is in it.
  • Status script shell text. ${uninstalledNote("$STATE")} gives ... sh $STATE/context-guru-install, then restart OpenCode inside double quotes. The text has no ", backtick or other $, so the shell expands only $STATE. The test checks the expanded path.
  • Install script after re-enable. It removes the marker, then either reports never-installed (purge) or starts the proxy through context-guru-start. The next start registers all six commands. The cycle test covers this path with a stub binary.
  • TUI. tui() returns before registerPickerCommands when the marker exists. isDisabled joins the other named exports of index.js (stateDirectory, runCommandScript, and others), so it adds no new kind of export.
  • Tests. The new file uses port range 10100. No other test file uses it. Each test uses its own project directory under a fresh CONTEXT_GURU_STATE. There is no time.Sleep-style wait: the tests use waitUntilUnhealthy. The two changed assertions in commands.test.mjs and v2.test.mjs pinned the old behavior. The owner decision changes them on purpose.
  • Docs. I searched for stale text ("disabled for this project", "re-enables it", "next OpenCode start writes the command scripts"). I found none left. install-opencode-plugin.md:193 ("uninstall, then install, then restart") still works, because the commands stay until the restart.
  • Data dependence. The change reads only the marker file. No row change is needed.
  • I did not run the tests. Live tests are not approved for this review.

Real OpenCode test of #1291: the uninstall output said
undo=/context-guru-install, but that command is gone after a restart.
It now names the script path. The fallback note read as if
fallback: false were set, and an agent told the user so; it now says
"only if you set the plugin option fallback: false yourself".

Signed-off-by: Vitaly Zabershinsky <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
@vz-ibm

vz-ibm commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

Real OpenCode 1.19.5 test of this PR (sandbox, released v0.7.6 proxy): after uninstall and a restart, /context-guru-status is unknown, no command is in the config, no proxy starts, and prompts go straight to the provider. The install script brings all six commands back. The ctrl+p menu is not tested (needs a person).

The test found two wording problems in the uninstall output, fixed in c69b16f:

  • undo=/context-guru-install named a command that is gone after a restart. It now names the script: undo=sh <state>/context-guru-install, then restart OpenCode.
  • The fallback note read as if fallback: false were set, and the agent told the user so. It now says "only if you set the plugin option fallback: false yourself (it is on by default)".

The cycle test pins both; it failed before the fix. The suite passes 121 of 121.

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (claude, user of @vz-ibm) Claude Code 2.1.325 offload-review skill, @vz-ibm's session resumed 2 of 2 2 of 2 c69b16f01076 approve

Verdict: approve

Findings

None.

Status of earlier points

Neither reviewer raised a blocking finding in round 1. The status of the non-blocking points:

  • Reviewer 2: undo=/context-guru-install names a command that is gone after a restart. Fixed at index.js:576 and in the plan note at :544. The cycle test pins the new undo= line (disabled.test.mjs:166).
  • Reviewer 2: the uninstall outro at index.js:830 says the same. Not fixed. See the first non-blocking point below.
  • Reviewer 1 and 2: the path in the way-back line has no quotes. Not changed, and the author did not reply. The default root has no space, so this stays non-blocking.
  • Reviewer 1: the new uninstall note= line has no test. Partly fixed. The cycle test now checks the new undo= line and the fallback note (disabled.test.mjs:166-168). It does not check the note=after an OpenCode restart ... line at :575. The undo= line carries the same fact, so this is enough.
  • Reviewer 2: no test for the catch path of disabledStart. Not changed. Still non-blocking.
  • Reviewer 1 and 2: not run in a real OpenCode. Done for OpenCode 1.19.5, as the author's comment says. The ctrl+p menu is not tested yet. It needs a person.

Non-blocking

  • opencode-plugin/index.js:830 — the uninstall outro still has the two texts that this commit fixed in the script output.
    • The outro tells the agent: "(with the plugin option fallback: false, they must restart OpenCode first), and that /context-guru-install undoes this".
    • The author's real test showed that an agent read the same fallback wording as "fallback: false is set" and told the user so. The outro has that wording. The agent reads it on every /context-guru-uninstall call.
    • "/context-guru-install undoes this" is true only until a restart. Now the script output says undo=sh <state>/context-guru-install, then restart OpenCode. So the agent gets two different ways back.
    • Fix: use the same words as the script: "only if the user set the plugin option fallback: false (it is on by default)", and "the undo line in the output gives the way back".
  • The ctrl+p check in a real TUI is still open. The author's comment says so. Do it before merge, because only a fake TUI API tests tui.js.

What I checked

  • Last review: round 1, 230a34f273413c8857d7140d8b9f50ea7ca3f0d3, 2026-11-23T05:44:09Z
  • New commits read: 1
    • c69b16f0 fix(opencode): name the install script as the way back after uninstall
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
  • New items since my last review:
    • Review by reviewer 1, round 1, 05:44:37Z, verdict approve, no findings. I checked each of its non-blocking points (see "Status of earlier points").
    • Comment by @vz-ibm, 05:51:14Z: the result of the real OpenCode 1.19.5 test and the two wording fixes. I checked both fixes in the diff and in the test. I found the same wording left in the outro at :830 (non-blocking point above).
  • The diff 230a34f2..c69b16f0 (2 files, +7/-3):
    • index.js:544: the plan note now names sh $STATE/context-guru-install and says that fallback: false applies only if the user set it. $STATE is inside double quotes, and STATE is shQuoted. The new text has no ", backtick or other $. So the shell expands only $STATE.
    • index.js:574: the same fallback wording in the --yes output.
    • index.js:576: undo= now names the script and the restart. The same quoting check holds.
    • disabled.test.mjs:165-168: two new assertions in the cycle test. The first compares the expanded path exactly. The second matches the fallback text. Both can fail.
  • I searched the plugin for other /context-guru-install undoes and undo= texts. Only :830 is left.
  • Behavior: the change is text only. It does not change what the scripts do, so the behavior-change rule does not apply to it.
  • I did not run the tests. Live tests are not approved for this review.

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (claude, user of @vz-ibm) Claude Code 2.1.325 offload-review skill, @vz-ibm's session resumed 1 of 2 2 of 2 c69b16f01076 blocking

Verdict: blocking

Findings

  1. opencode-plugin/index.js:830 — the uninstall command text still gives the agent both wordings that c69b16f removed from the script.
    • What fails: the user runs /context-guru-uninstall. The agent reads the outro, which tells it to say two things:
      • "with the plugin option fallback: false, they must restart OpenCode first". This is the wording that, in the real OpenCode test, made the agent tell the user that fallback: false was set.
      • "/context-guru-install undoes this". After a restart, that command does not exist.
        The script output (:544, :576) now says the correct thing. The outro is an instruction to the agent, so the agent can follow it and repeat the old, wrong text. The user then gets two different answers in one reply.
    • Proof: git show c69b16f0 -- opencode-plugin/index.js changes only :544, :574 and :576. :830 at head still has (with the plugin option fallback: false, they must restart OpenCode first), and that /context-guru-install undoes this. The author's PR comment (2026-11-23T05:51:14Z) says that a real agent repeated the fallback wording to the user. Reviewer 2 (round 1, first non-blocking point) named :830 for the undo part. I agree with that after my own check. The fallback part of :830 is new in this round.
    • Fix: make the outro match the script. For example: "Tell them that open sessions now send requests straight to the provider. Only if they set the plugin option fallback: false themselves (it is on by default), they must restart OpenCode. To undo it: /context-guru-install in this session, or sh /context-guru-install after a restart, then restart OpenCode." Add one assert on COMMAND_SPECS/the registered template, for example that the uninstall template does not contain with the plugin option fallback: false, they must.

Non-blocking

  • Path quoting (my round-1 point; reviewer 2's second point): not fixed. The way-back lines still print sh <path>/context-guru-install with no quotes. The author did not reply to it. The default state path has no space, and apply=sh $STATE/... uses the same form. I accept it as a rare case.
  • disabledStart catch path has no test (reviewer 2's third point): not fixed. The path is fail-open and only logs. Small value.
  • The note=after an OpenCode restart, ... line at :575 still has no direct assert. The new undo= assert covers the same fact, so the gap is small.

What I checked

  • Last review: round 1, 230a34f, 2026-11-23T05:44:37Z
  • New commits read: 1 — c69b16f0 fix(opencode): name the install script as the way back after uninstall
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
  • New items since my last review:
    • Author comment by vz-ibm, 2026-11-23T05:51:14Z: a real OpenCode 1.19.5 test passed, except the ctrl+p menu, which a person must check. It found two wording problems, fixed in c69b16f0. I checked both fixes in the script (:544, :574, :576) and the two new asserts in the cycle test. I found that the same two wordings stay in the uninstall outro (:830). That is finding 1.
    • Commit c69b16f0: read in full (3 lines in index.js, 4 lines in disabled.test.mjs).
  • Earlier findings:
    • My round 1 had no findings. Non-blocking: the note test is now fixed (asserts on undo= and on the fallback note). The real OpenCode check is done, except ctrl+p. Shell environment: the author's real test ran the install script and got all six commands back; no problem reported. Quoting: not fixed, accepted (see above).
    • Reviewer 2 round 1 had no findings. Non-blocking: :576 and :544 fixed; :830 not fixed (finding 1); quoting not fixed; catch-path test not fixed; data dependence "None" is correct.
  • New text is correct. fallback is on unless options.fallback === false (index.js:1308), so "(it is on by default)" is true. $STATE is shQuoted at the top of the uninstall script, and the printf argument is in double quotes, so the path expands safely.
  • New test asserts. includes(\undo=sh ${join(state, "context-guru-install")}, then restart OpenCode`)matches the script output exactly. The regex/only if you set the plugin option fallback: false yourself/matches the--yesnote at:574`.
  • I did not run the tests. Live tests are not approved for this review.

Round 2 of #1291: the uninstall command text, which the agent follows,
still said "with the plugin option fallback: false, they must restart"
and "/context-guru-install undoes this". Now it says the fallback note
applies only if the user set fallback: false, and gives both ways back:
/context-guru-install in this session, or the install script after a
restart. A test reads the registered text.

Signed-off-by: Vitaly Zabershinsky <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
@vz-ibm

vz-ibm commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

Reply to round 2. Reviewer 1, finding 1 (the uninstall command text still had both old wordings): fixed in 6a9c580.

  • The text that the agent follows now says the fallback note applies only if the user set fallback: false themselves (it is on by default).
  • It gives both ways back: /context-guru-install in this session, or after a restart sh "<state>/context-guru-install" and a restart. The path keeps its quotes.
  • New test: it reads the registered context-guru-uninstall template, checks both points, and checks that the old wording is gone. It failed before the fix.

The suite passes 122 of 122.

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (claude, user of @vz-ibm) Claude Code 2.1.325 offload-review skill, @vz-ibm's session resumed 1 of 2 3 of 3 6a9c58070279 approve

Verdict: approve

Findings

None.

Non-blocking

  • opencode-plugin/test/disabled.test.mjs:97 — the new test uses the same project directory as the next test.
    • Both the new uninstall-text test (:97) and the TUI "disabled project" test (:110) use /tmp/context-guru-disabled-c. The TUI test writes the disabled marker in that state folder.
    • Today the tests run in file order, so the new test runs first and passes. If the order changes (a move, or a random order), the new test sees the marker. Then config.command is undefined, and config.command["context-guru-uninstall"] throws a TypeError.
    • My round-1 review said that each test uses its own directory. That is no longer true.
    • Fix: use a new letter, for example /tmp/context-guru-disabled-i.
  • Path quoting: not fixed, still accepted. The way-back lines in the script output print the path with no quotes. The new outro text keeps the JSON quotes, so the agent's way back is quoted. The default state path has no space.
  • disabledStart catch path has no test (reviewer 2, round 1): not fixed. Fail-open, only logs. Small value.
  • The ctrl+p check in a real TUI is still open. The author's comment says that it needs a person. Do it before merge.

What I checked

  • Last review: round 2, c69b16f, 2026-11-23T05:52:15Z
  • New commits read: 1 — 6a9c5807 fix(opencode): make the uninstall command text match the script
  • Read in full: 4 reviews, 2 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Comment by @vz-ibm, 2026-11-23T05:57:37Z: says that my round-2 finding 1 is fixed in 6a9c5807, with a new test, and that the suite passes 122 of 122. I checked the fix and the test (see below). I did not run the suite.
    • Commit 6a9c5807: read in full (1 line in index.js, 14 lines in disabled.test.mjs).
    • Reviewer 2's round-2 review (05:52:06Z) is older than my round-2 review, but I had not read it before. Its only open point is the :830 outro, which is the same as my finding 1. It is now fixed.
  • Earlier findings:
    • Reviewer 1, round 2, finding 1 (the uninstall outro still had the old fallback and undo wording): fixed. index.js:830 now says "Only if they set the plugin option fallback: false themselves (it is on by default)". It gives both ways back: /context-guru-install in this session, or the install script and a restart after a restart. The old text "with the plugin option fallback: false, they must" is gone.
    • Reviewer 2 had no findings in round 1 or round 2. Status of its non-blocking points: :544/:576 fixed in round 2; :830 fixed now; quoting and the catch-path test not changed, both accepted.
  • The path rewrite in the outro. v1 passes path(spec.script) = JSON.stringify(join(state, "context-guru-uninstall")) (index.js:861). v2 passes the same JSON.stringify(...) form (index.js:1401). So the string ends in context-guru-uninstall". The regex /context-guru-uninstall("?)$/ replaces only that tail, and keeps the closing quote. The result is "<state>/context-guru-install". A raw path with no quotes also works, because the quote group is optional.
  • The new test can fail. It reads the registered v1 template. It checks the exact quoted install path, the new fallback text, and the absence of the old text. The author says that it failed before the fix. That is consistent with the old outro, which had none of the new text.
  • Behavior. The commit changes only the text that the agent reads. The scripts do the same as before, so the behavior-change rule does not apply.
  • I did not run the tests. Live tests are not approved for this review.

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (claude, user of @vz-ibm) Claude Code 2.1.325 offload-review skill, @vz-ibm's session resumed 2 of 2 3 of 3 6a9c58070279 approve

Verdict: approve

Findings

None.

Status of earlier points

  • Reviewer 1, round 2, finding 1 (the uninstall outro at index.js:830 still has both old texts): fixed in 6a9c5807. I agree. This was also my round-2 non-blocking point.
    • The fallback sentence now says "Only if they set the plugin option fallback: false themselves (it is on by default)". This matches the script output at :544 and :574.
    • The undo sentence now gives both ways back: /context-guru-install in this session, or sh "<state>/context-guru-install" and a restart after a restart.
  • Path quoting (reviewer 1 and 2, round 1): partly fixed. The outro path keeps its JSON.stringify quotes. The log line (:332) and the script note=/undo= lines still have no quotes. Both reviewers accepted this as a rare case.
  • No test for the catch path of disabledStart (reviewer 2, round 1): not fixed. Still non-blocking. The path is fail-open and only logs.
  • No direct assert on the note=after an OpenCode restart line at :575 (reviewer 1): not fixed. The undo= assert covers the same fact. Accepted.
  • The ctrl+p check in a real TUI: still open, as the author said on 05:51. A person must do it.

Non-blocking

  • opencode-plugin/test/disabled.test.mjs:97 — the new test uses the same project directory as the next test (/tmp/context-guru-disabled-c).
    • The next test (TUI, disabled) writes the disabled marker in that directory.
    • Today this is safe, because node:test runs the tests of one file in order, and the new test runs first.
    • If someone moves the new test after the TUI test, hooks.config sees the marker, registers no command, and config.command["context-guru-uninstall"] throws. Use its own directory (for example -i).

What I checked

  • Last review: round 2, c69b16f01076cef6e7ad64eb058774f95bb66556, 2026-11-23T05:52:06Z
  • New commits read: 1
    • 6a9c5807 fix(opencode): make the uninstall command text match the script
  • Read in full: 4 reviews, 2 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Review by reviewer 1, round 2, 05:52:15Z, verdict blocking, finding 1 on :830. I checked it against the new commit: fixed (see above).
    • Comment by @vz-ibm, 05:57:37Z: reply to that finding, fix in 6a9c5807, new test, 122 of 122 pass. I checked the fix and the test in the diff. I did not run the suite.
  • The outro path rewrite. path.replace(/context-guru-uninstall("?)$/, "context-guru-install$1").
    • OpenCode 1 passes JSON.stringify(join(state, name)) (index.js:856). OpenCode 2 passes JSON.stringify(join(state, spec.script)) in setupV2. Both end in context-guru-uninstall".
    • The regex keeps the closing quote. So the result is "<state>/context-guru-install". The test checks this exact string.
    • The state directory name is a 16-character hex hash, so context-guru-uninstall can only match at the end.
  • The new text is true. fallback is on unless options.fallback === false (index.js:1308). /context-guru-install works in the same session, because OpenCode keeps the commands it loaded until a restart.
  • The new test can fail. It reads the registered OpenCode 1 template. It checks the quoted install path, the new fallback text, and that the old fallback text is gone. The author says that it failed before the fix.
  • I searched index.js for other /context-guru-install undoes and with the plugin option fallback: false, texts. None are left.
  • Behavior: the change is text only. It changes no script and no routing.
  • I did not run the tests. Live tests are not approved for this review.

…e-after-uninstall

Signed-off-by: Vitaly Zabershinsky <[email protected]>

# Conflicts:
#	opencode-plugin/index.js
OpenCode cannot drop commands from a running session. After
/context-guru-uninstall, update, preset and strategy still ran there.
Now, as in the Pi package, each of them prints enabled=no with the way
back and stops, and the command text tells the agent to say only that
context-guru is uninstalled. A command whose script is gone (after
--purge, or after the installer removed the state folder) prints the
same instead of a shell error, in OpenCode 1, OpenCode 2 and the TUI.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>
Owner decision (2026-11-25), which replaces "no command after an
uninstall": a project with the uninstall marker registers only
/context-guru-install, described "Turn context-guru on again in this
project", in OpenCode 1 and 2. The other 5 commands stay gone. The way
back no longer needs the hidden state path.

The guard tests now use the stub proxy and stop it at the end, so the
suite leaves no proxy running.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>
@vz-ibm

vz-ibm commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Update, 2026-11-25:

  • Merged main (55 commits). One conflict in opencode-plugin/index.js: the disabled start and the new session signals (feat(opencode-plugin): send lifecycle signals to the proxy #1313) were added at the same place. Both stay. In OpenCode 2 the disabled check comes first.
  • New: in the session of an uninstall, update, preset and strategy change nothing (as in Pi). A command whose script is gone says "uninstalled".
  • New, owner decision: after an uninstall and a restart, /context-guru-install stays as the way back. The other 5 commands stay gone.
  • The guard tests use the stub proxy and stop it, so the suite leaves no proxy running.
  • Tested by the owner on macOS, OpenCode 1.19.6: uninstall in OpenCode, restart, and the way back.
  • Plugin tests: 129 pass, 0 fail.

Local tests: waived (owner rule)

Assisted-By: Claude (Anthropic AI) [email protected]

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (claude, user of @vz-ibm) Claude Code 2.1.325 offload-review skill, @vz-ibm's session resumed 1 of 2 4 of 4 b59633e2ab4e blocking

Verdict: blocking

Findings

  1. opencode-plugin/tui.js:31-38 — in the session of an uninstall, the ctrl+p pickers say "No preset script found", not "uninstalled".
    • What fails: the user runs /context-guru-uninstall --yes, then opens ctrl+p → "Context Guru: preset" (or cache strategy) in the same session. The TUI entries stay until a restart.
      • The picker script now stops at stopIfUninstalled() and prints only enabled=no and note=..., with status 0.
      • pickAndSwitch sees choices.length === 0 and shows the error toast No preset script found. Start OpenCode once with the Context Guru plugin enabled.
      • The same toast shows when the script is gone: runCommandScript returns GONE_OUTPUT (enabled=no, no choices).
      • So the user gets a wrong message ("no script", "start OpenCode once") and no way back.
    • Proof: 0dcb3cab says "A command whose script is gone ... prints the same [uninstalled] ... in OpenCode 1, OpenCode 2 and the TUI". The PR body says the same. But tui.js is not changed in 0dcb3cab or b59633e2. pickAndSwitch (tui.js:28-38) reads only choices and reason=no-strategy-table. It never reads facts.enabled or facts.note. The new test runCommandScript for a script that is gone (disabled.test.mjs) checks the output of runCommandScript only, not what the TUI shows. No test drives pickAndSwitch with the marker. Nothing changes on disk, so this is not a fail-open problem. It is wrong output for the new behavior.
    • Fix: in pickAndSwitch, before the choices check: if (facts.enabled === "no") { toast(api, "info", facts.note ?? "context-guru is uninstalled for this project"); return }. Add one test with a fake api.ui.toast that runs pickAndSwitch after disable(directory) and checks the toast text.

Non-blocking

  • The PR body "What changed" and "How it was tested" are out of date. They still say "register no command", "8 tests" and "121 pass". The top section is correct. The code now registers /context-guru-install, the file has 13 tests, and the author's comment says 129 pass.
  • docs/how-to/install-opencode-plugin.md:24-29 names only the shell way back. After a restart, /context-guru-install is still listed and is the simpler way. The README (:46) and the uninstall output name both. Add one line to the how-to.
  • The 2026-11-25 owner decision is recorded only in agent-written text. The commit, the PR body and the 15:48 comment carry Assisted-By. CLAUDE.md says that an agent's report of a decision does not count. If @vz-ibm is the owner who decided, one short line from them on the PR closes this.
  • disabled.test.mjs: the uninstall-text test and the TUI disabled test still share /tmp/context-guru-disabled-c. Both reviewers raised this in round 3. Not fixed and not answered. It passes today only because of file order.
  • Not changed, still accepted: no quotes on the path in the way-back lines; no test of the catch path in disabledStart.
  • GONE_OUTPUT also applies to /context-guru-install. If that script is gone, its note says "restart OpenCode to remove these commands", which does not help there. disabledStart rewrites the script at each start, so this case is rare.

What I checked

  • Last review: round 3, 6a9c580, 2026-11-23T06:42:03Z
  • New commits read: 3 PR commits, plus 55 main commits through the merge:
    • f11d867a Merge remote-tracking branch 'origin/main' into fix/1290-opencode-gone-after-uninstall
    • 0dcb3cab fix(opencode): after an uninstall, open-session commands change nothing
    • b59633e2 feat(opencode): keep /context-guru-install after an uninstall
    • The 55 main commits (98c9a740 … 22a6e3cb) are already on the new base 22a6e3cb. I did not review them as part of this PR. I checked the merge result through the PR diff 22a6e3cb..HEAD (7 files, +413/-38), which I read in full.
  • Read in full: 6 reviews, 3 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Review by reviewer 2, round 3, 2026-11-23T06:42:04Z, approve. Its only new point is the shared test directory, the same as mine. Still open (non-blocking above).
    • Comment by @vz-ibm, 2026-11-25T15:48:21Z: merge of main with one conflict, the session guards, the owner decision to keep /context-guru-install, stub proxies in the guard tests, a test on macOS with OpenCode 1.19.6, 129 pass, Local tests: waived (owner rule). I checked each code claim in the diff. The TUI claim of 0dcb3cab is not true (finding 1). I did not run the tests.
  • Merge conflict. In setupV2, the disabled check now comes before the ctx.event.subscribe block from #1313, so a disabled project subscribes to no event. In OpenCode 1, the event hook stays, but createSignaler.handle returns when port is not set. The port is set only after routing, which a disabled start skips. So no signal goes out.
  • Disabled start, OpenCode 1. disabledStart writes context-guru-install and logs once. Then registerCommand(config, state, INSTALL_SPEC, ENABLE_DESCRIPTION) adds only that command. It is in a try. Routing and startProxy do not run. The state folder exists because the marker is in it.
  • Disabled start, OpenCode 2. The same, through addV2Command, in a try. It returns before provider.transform, so no http.request hook is registered.
  • registerCommand embed. !\if [ -f "" ]; then sh ""; else printf '%s' '<GONE_OUTPUT>'; fi`. shQuotequotesGONE_OUTPUT, which has no '. The text has newlines, but no backtick, so the !`...`block still parses. The cycle test runs the install block from the template and getsresult=re-enabled`.
  • Session guards. stopIfUninstalled() is placed after STATE= in the update and picker scripts. It is not in the install, status or uninstall scripts. That is correct: install must clear the marker, and status must report it. I found no other caller of the picker or update scripts (installer or plugin start) that the guard could break.
  • STOP_AT_UNINSTALLED. commandText adds it to every command but status. The install script never prints enabled=no while the marker exists (it removes the marker and prints result=re-enabled), so the rule does not stop the way back.
  • Tests. The guard test checks update, preset and strategy with 3 argument sets each: exit 0, exactly 2 lines, enabled=no, then the way-back note. The gone-script tests check the v1 embed and runCommandScript. withStartedV1 stops the stub proxy in finally.
  • Behavior change. The PR top names the 2026-11-25 changes: who, old, new, way back, no switch. See the non-blocking point about who recorded the yes.
  • Data dependence. Unchanged: the change reads only the marker file.
  • I did not run the tests. Live tests are not approved for this review.

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (claude, user of @vz-ibm) Claude Code 2.1.325 offload-review skill, @vz-ibm's session resumed 2 of 2 4 of 4 b59633e2ab4e approve

Verdict: approve

Findings

None.

Status of earlier points

  • No reviewer raised a blocking finding in round 3. Reviewer 1 and I both approved 6a9c5807.
  • Shared test directory /tmp/context-guru-disabled-c (reviewer 1 and 2, round 3): not fixed. disabled.test.mjs:100 and :113 still use the same directory. The author did not reply. The tests pass in file order. This stays non-blocking.
  • Path quoting in the log line and the script note=/undo= lines: not fixed, accepted. The new way back is the command /context-guru-install, so the user does not need the path in most cases. The risk is now smaller.
  • No test for the catch path of disabledStart: not fixed, accepted. The new catch blocks around registerCommand and command.transform have no test either. All of them only log.
  • The real OpenCode check: the author's comment (2026-11-25) says that the owner tested uninstall, restart and the way back on OpenCode 1.19.6. The comment does not say that the ctrl+p palette was checked.

Non-blocking

  • opencode-plugin/tui.js:31-38 — in the session of an uninstall, the ctrl+p picker shows a wrong toast.
    • The palette entries stay until a restart. The user picks "Context Guru: preset". runCommandScript runs the picker script. The new stopIfUninstalled prints enabled=no and the note, with status 0.
    • parsePickerOutput finds no choice line. So pickAndSwitch shows "No preset script found. Start OpenCode once with the Context Guru plugin enabled."
    • That text is wrong: the script exists, and context-guru is uninstalled. The commit message of 0dcb3cab says that the TUI says "uninstalled". It does not. Nothing changes, so this is safe.
    • Fix: in pickAndSwitch, when facts.enabled === "no", show facts.note (or "context-guru is uninstalled for this project") as the toast. The test at disabled.test.mjs:265 checks only runCommandScript, not the toast.
  • opencode-plugin/index.js GONE_OUTPUT — the text assumes an uninstall. It says "context-guru is uninstalled; restart OpenCode to remove these commands" for any script that is missing. If a script is gone for another reason (for example, a user deleted the state folder while context-guru was on), a restart brings all six commands back. This is rare.
  • docs/how-to/install-opencode-plugin.md:177-184 — the "turn on again" block names only the shell script. The list above it and the README now give /context-guru-install first. Add it here too: "Run /context-guru-install in that project, or the script from any shell, then restart OpenCode."
  • The PR body "What changed" and "How it was tested" are out of date. They still say "register no command", "8 tests" and "121 pass". The top section and the 2026-11-25 comment are correct (129 pass). Update the body before merge, because the squash message may use it.

What I checked

  • Last review: round 3, 6a9c580702794fc886df5ba646abaf3f7a45bead, 2026-11-23T06:42:04Z
  • New commits read: 3 PR commits, and the merge brings 55 commits from main
    • f11d867a Merge remote-tracking branch 'origin/main' into fix/1290-opencode-gone-after-uninstall
    • 0dcb3cab fix(opencode): after an uninstall, open-session commands change nothing
    • b59633e2 feat(opencode): keep /context-guru-install after an uninstall
  • Read in full: 6 reviews, 3 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Review by reviewer 1, round 3, 06:42:03Z, approve. Its points are the same as mine (shared test directory, quoting, catch path, ctrl+p). Status above.
    • Comment by @vz-ibm, 2026-11-25T15:48:21Z: the merge, the two new changes, the owner decision, the owner's test on OpenCode 1.19.6, 129 pass, and Local tests: waived (owner rule). I checked each code claim in the diff (below). I did not run the suite.
  • The merge f11d867a. I used git show --remerge-diff. The only conflict is in index.js: disabledStart and the new session signals (#1313) were added at the same place. The resolution keeps both. In OpenCode 2, the disabled check comes before ctx.event.subscribe, so a disabled project sends no signals. In OpenCode 1, the event hook stays. But signaler.setPort runs only on the routed path, so handle returns at !port. A disabled project sends no signal in either version. Apart from the conflict, the PR diff against the new base is the same as before the merge.
  • 0dcb3cab, guards in the open session.
    • stopIfUninstalled runs in the update script and the picker script (preset and strategy), right after STATE=. It prints enabled=no and the note and exits 0, before any download, save or restart. The test at disabled.test.mjs:228 runs each of the 3 scripts with no argument, set none and --yes, and checks exactly 2 lines.
    • The uninstall and install scripts have no guard, which is correct. A second uninstall (for example, with --purge) still works. The install script is the way back.
    • STOP_AT_UNINSTALLED goes into every command text except status. The install script prints result=re-enabled with the marker, not enabled=no, so the stop text does not block the way back.
    • A missing script: the OpenCode 1 template runs if [ -f "<path>" ]; then sh "<path>"; else printf '%s' '<GONE_OUTPUT>'; fi. shQuote quotes the output, and JSON.stringify quotes the path, as before. runCommandScript (OpenCode 2 and the TUI) returns GONE_OUTPUT with status 0 before it spawns.
  • b59633e2, keep /context-guru-install.
    • With the marker, OpenCode 1 calls registerCommand(config, state, INSTALL_SPEC, ENABLE_DESCRIPTION) after disabledStart. disabledStart wrote the install script first, so the template finds it. OpenCode 2 does the same through addV2Command. Both have a try/catch and only log on an error. Routing stays off.
    • INSTALL_SPEC is found by name in COMMAND_SPECS. It is defined at module load, so a rename would fail the tests at once.
    • registerCommands and the OpenCode 2 loop now use the same registerCommand/addV2Command helpers. The text for an enabled project is the same as before, plus the stop sentence and the missing-script guard.
    • The cycle test now takes the ! block from the registered install template and runs it in a plain shell. That tests the path that the user takes.
    • Tests that start a proxy now use the stub binary and stop it in finally, with waitUntilUnhealthy. None waits on time.
  • Behavior change rule. The top of the PR names who is affected, the old and new behavior, and "no switch". It records the owner decision of 2026-11-25 by @vz-ibm, a human developer.
  • Data dependence. Still none: the change reads only the marker file and whether a script exists.
  • Library or host. All changes are in the OpenCode plugin. No Go code changes, so the "What goes in the proxy" rules do not apply.
  • I did not run the tests. Live tests are not approved for this review.

In the session of an uninstall, the preset and strategy pickers stay in
ctrl+p until a restart. They showed "No preset script found. Start
OpenCode once". Now, when the disabled marker exists, they show the
script's uninstalled note and open no dialog.

A missing script without the marker is still a first start, and keeps
the old error toast.

Also: the TUI disabled test gets its own directory, and the how-to names
/context-guru-install as the way back.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>
@vz-ibm

vz-ibm commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator Author

Reply to round 4.

Reviewer 1, finding 1, and reviewer 2, non-blocking 1 (the ctrl+p pickers say "No preset script found" after an uninstall): fixed in dbd3122.

  • pickAndSwitch now checks for enabled=no and the disabled marker before it reads the choices. Then it shows the script's note as an info toast and opens no dialog.
  • It checks the marker as well, because a missing script without the marker is a first start. There the old "No ... script found. Start OpenCode once" toast stays correct. The existing test "without an installed script the picker shows a toast and no dialog" pins that case, and it still passes.
  • 2 new tests in tui.test.mjs: one with the marker and the scripts present (the session of an uninstall), and one with the marker and no script. Both failed first with the old error toast.

Shared test directory /tmp/context-guru-disabled-c (both reviewers, rounds 3 and 4): fixed in dbd3122. The TUI disabled test now uses /tmp/context-guru-disabled-tui.

The how-to names only the shell way back (both reviewers): fixed in dbd3122. The "turn on again" text now names /context-guru-install first, then the script.

The PR body is out of date (both reviewers): fixed. "What changed" and "How it was tested" now match the code: only the install command after a restart, 13 + 2 tests, 131 pass, 0 fail, 4 timing tests skipped.

GONE_OUTPUT assumes an uninstall (both reviewers): not changed. The TUI now shows it only when the marker exists. In chat, a missing script without the marker means someone deleted the state folder. A restart writes all the scripts again, so the note "restart OpenCode" still leads to a working state. This is rare.

The owner decision is recorded only in agent-written text (reviewer 1): open. This needs one line from @vz-ibm on the PR. An agent cannot close it.

Still accepted, not changed: no quotes on the path in the way-back lines, and no test of the catch paths.

Assisted-By: Claude (Anthropic AI) [email protected]

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (claude, user of @vz-ibm) Claude Code 2.1.325 offload-review skill, @vz-ibm's session resumed 1 of 2 5 of 5 dbd31228675c approve

Verdict: approve

Findings

None.

Non-blocking

  • The 2026-11-25 owner decision still has no line from a person on the PR. The author's reply says that an agent cannot close this. I agree. It is a merge gate, not a code defect: before merge, @vz-ibm writes one line on the PR that confirms "keep /context-guru-install after an uninstall" and the in-session guards.
  • Still accepted, not changed: no quotes on the path in the way-back lines; no test of the catch paths; GONE_OUTPUT assumes an uninstall. The author's reason for GONE_OUTPUT is right: in chat, a missing script without the marker is rare, and "restart OpenCode" leads to a working state. In the TUI, the note now shows only when the marker exists.

What I checked

  • Last review: round 4, b59633e, 2026-11-29T07:01:56Z
  • New commits read: 1 — dbd31228 fix(opencode): the ctrl+p pickers say uninstalled after an uninstall
  • Read in full: 8 reviews, 4 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Review by reviewer 2, round 4, 2026-11-29T07:02:08Z, approve. Its first non-blocking point is the same as my finding 1 (the ctrl+p toast). Its other points are GONE_OUTPUT, the how-to way back and the stale PR body. I checked the status of each one below.
    • Comment by @vz-ibm, 2026-11-29T07:08:48Z: reply to round 4. I checked each claim against dbd31228 and the PR body:
      • ctrl+p toast: fixed (see below).
      • Shared test directory: fixed. The TUI disabled test now uses /tmp/context-guru-disabled-tui. /tmp/context-guru-disabled-c now has only one user.
      • How-to way back: fixed. install-opencode-plugin.md:177-179 names /context-guru-install first, then the script.
      • PR body: fixed. The author says it now matches the code. I did not read the new body in full this round. I checked the comment's numbers against the code: disabled.test.mjs has 13 tests and tui.test.mjs has 2 new ones.
      • GONE_OUTPUT: not changed, with a reason. I accept the reason (above).
      • Owner decision: open (above).
  • Earlier findings:
    • Reviewer 1, round 4, finding 1 (tui.js:31-38, wrong toast in the session of an uninstall): fixed. pickAndSwitch now checks facts.enabled === "no" && isDisabled(state) before the choices check. Then it shows facts.note as an info toast and returns, so no dialog opens. parsePickerOutput reads note=... into facts.note with the regex ^([a-z_]+)=(.*)$, so the note is the full line text.
    • Both cases are covered: the script exists (stopIfUninstalled prints the way-back note), or the script is gone (runCommandScript returns GONE_OUTPUT).
    • Without the marker, a missing script still gets the old "No ... script found. Start OpenCode once" toast. That case is a first start, so the old text is right there.
  • New tests in tui.test.mjs.
    • "in the session of an uninstall": starts a stub proxy through setup, writes the marker, runs pickAndSwitch(..., "preset"). It checks that no dialog opens, that exactly 1 info toast shows, and the way-back text. In finally, it stops the stub by its pid and waits with waitUntilUnhealthy. That is the same cleanup as the other tests in the file.
    • "when the picker script is gone": a fresh directory with only the marker. It checks the exact toast { variant: "info", message: <GONE_OUTPUT note> } and no dialog.
    • Both tests can fail. The author says that both failed first with the old error toast. That matches the old code, which never read facts.enabled.
    • Neither new test waits on time.
  • Fail open. The change is in the TUI only. It reads a file and shows a toast. No routing and no script behavior change.
  • Data dependence. Unchanged: the change reads only the marker file.
  • I did not run the tests. Live tests are not approved for this review.

@vz-ibm vz-ibm left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (claude, user of @vz-ibm) Claude Code 2.1.325 offload-review skill, @vz-ibm's session resumed 2 of 2 5 of 5 dbd31228675c approve

Verdict: approve

Findings

None.

Status of earlier points

  • Reviewer 1, round 4, finding 1 (the ctrl+p pickers say "No preset script found" after an uninstall): fixed in dbd31228. This was also my round-4 non-blocking point 1. I checked it (see below).
  • Shared test directory /tmp/context-guru-disabled-c (both reviewers, rounds 3 and 4): fixed. The TUI disabled test now uses /tmp/context-guru-disabled-tui. I searched the file. No other test uses that name.
  • The how-to names only the shell way back (both reviewers): fixed. install-opencode-plugin.md:177 now names /context-guru-install first, then the script.
  • The PR body is out of date (both reviewers): fixed. "What changed" and "How it was tested" now say "only the install command", 13 + 2 tests, and 131 pass. One small leftover: "The uninstall output says that the commands are gone after a restart". The output now says "only /context-guru-install is left". This is not important.
  • GONE_OUTPUT assumes an uninstall (my round 4): not changed, and the author gave a reason. The author says: a missing script without the marker means someone deleted the state folder, and a restart writes all scripts again. So "restart OpenCode" still leads to a working state. I accept this. The TUI now shows this note only when the marker exists.
  • The 2026-11-25 owner decision is in agent-written text only (reviewer 1, round 4): open. I agree with reviewer 1. I checked issue #1290. Its only comment (2026-11-23) asks for no command after a restart. The change to "keep /context-guru-install" is in the PR body, the commit and the 2026-11-25 comment. All three carry Assisted-By. CLAUDE.md says that an agent's report of a decision does not count. Before merge, @vz-ibm must write one line on the PR or the issue in their own words. This is a merge check, not a code defect, so I do not block on it.
  • No quotes on the path in the way-back lines, and no test of the catch paths: not changed, accepted by both reviewers.

Non-blocking

  • The ctrl+p palette is still not tested in a real TUI. The PR body says so. The new fix is in tui.js, which only a fake API tests. One manual check closes this: uninstall, then open "Context Guru: preset" in the same session.

What I checked

  • Last review: round 4, b59633e2ab4eb26eac1d251bdd84831ffbeccc35, 2026-11-29T07:02:08Z
  • New commits read: 1
    • dbd31228 fix(opencode): the ctrl+p pickers say uninstalled after an uninstall
  • Read in full: 8 reviews, 4 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Review by reviewer 1, round 4, 2026-11-29T07:01:56Z, blocking, finding 1 on tui.js:31-38. It is fixed (see above). I also checked its non-blocking points: the PR body, the how-to, the owner decision, the shared directory and GONE_OUTPUT. Their status is above.
    • Comment by @vz-ibm, 2026-11-29T07:08:48Z: a reply to each round-4 point. I checked each "fixed" claim in the diff and in the PR body. I checked the GONE_OUTPUT reason and accept it. I agree that the owner-decision point stays open.
    • I also read the comment on issue #1290, to check the owner decision.
  • tui.js:32-36, the new check.
    • pickAndSwitch runs the picker script. With the marker, stopIfUninstalled prints enabled=no and note=<way back>, with status 0. parsePickerOutput puts both in facts. The new check shows facts.note as an info toast and returns before any dialog.
    • With the marker and no script, runCommandScript returns GONE_OUTPUT. That has enabled=no and a note too, so the same check shows that note.
    • Without the marker, the check does not run. A missing script then gives GONE_OUTPUT, no choices, and the old "No … script found. Start OpenCode once" toast. That is correct for a first start.
    • isDisabled was already imported in tui.js. The check runs before shown.status and choices, so the no-strategy-table path does not change.
    • The set and --restart calls in confirmSwitch and confirmRestart cannot run after an uninstall in this flow, because the select dialog never opens.
  • tui.test.mjs, 2 new tests.
    • Test 1 starts a stub proxy through setup, writes the marker, runs pickAndSwitch and checks: no dialog, 1 info toast, and the way-back text. In finally, it kills the recorded pid and waits with waitUntilUnhealthy. There is no wait on time.
    • Test 2 uses a fresh folder with only the marker. It checks the exact GONE_OUTPUT note.
    • Both can fail: the old code showed an error toast with other text, and the author says that both failed first.
  • Docs. The how-to text matches the README and the uninstall output.
  • Behavior. The commit changes only what the TUI shows in an uninstalled project. It changes no script and no routing. Data dependence is still none.
  • I did not run the tests. Live tests are not approved for this review.

@vz-ibm

vz-ibm commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator Author

Real OpenCode test of dbd3122 (OpenCode 1.19.6, macOS, empty test folder, the plugin files of this PR installed). @vz-ibm did the TUI steps.

  • /context-guru-uninstall --yes in the test folder: the disabled marker is written, and that folder's proxy stops. The other project's proxy keeps running. ~/.config/opencode/opencode.json is not changed.
  • In the same session, ctrl+p → "Context Guru: preset": the toast says that context-guru is uninstalled, and no list opens. Pass.
  • ctrl+p → "Context Guru: cache strategy": the same. Pass.

Found during the test, not in this PR's scope: the OpenCode agent said that the uninstall is global when the plugin is in the global config. It is not. Filed as #1549.

Assisted-By: Claude (Anthropic AI) [email protected]

@vz-ibm

vz-ibm commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator Author

Addition to the real OpenCode test above, after an OpenCode restart in the same test folder (@vz-ibm did the steps):

  • ctrl+p: no "Context Guru" entry. Pass.
  • Typing /context-guru in the chat: only /context-guru-install shows. Pass.

Assisted-By: Claude (Anthropic AI) [email protected]

…e-after-uninstall

Signed-off-by: Vitaly Zabershinsky <[email protected]>

# Conflicts:
#	opencode-plugin/test/tui.test.mjs
@vz-ibm

vz-ibm commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator Author

Approved change

This branch has not been deployed

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

Labels

None yet

Projects

Status: New/ToDo

Development

Successfully merging this pull request may close these issues.

opencode: after uninstall and a restart, the context-guru commands are still there

1 participant