Simplify review: fix async retry off-by-one, TOCTOU, and stale docstring

- Mirror client.py retry fix in async_client.py (range + boundary alignment)
- Sync _kid default to agent_id + '-key-1' in async client
- Fix TOCTOU in opencode.py uninstall (try/except vs exists+remove)
- Update docstring to reflect new plugin path and filename
- Remove redundant deferred json import in _js_str

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 4.6 committed 2026-03-02 20:23:44 -05:00
1 parent 7934221403
commit 3c75c2296e
2 files changed
+7 -6

No files matched your search

+4 -3
View File
@@ -1,4 +1,4 @@
"""OpenCode plugin — writes .opencode/plugins/elydora-audit.js (JS plugin)."""
"""OpenCode plugin — writes ~/.config/opencode/plugins/elydora-audit.mjs (JS plugin)."""
from __future__ import annotations
@@ -80,8 +80,10 @@ class OpenCodePlugin(AgentPlugin):
def uninstall(self, agent_id: str = "") -> None:
plugin_path = self._plugin_path()
if os.path.exists(plugin_path):
try:
os.remove(plugin_path)
except FileNotFoundError:
pass
# Hook script removal is handled by cli.py cmd_uninstall (rmtree of agent dir)
print("Elydora hook uninstalled from OpenCode.")
@@ -298,5 +300,4 @@ module.exports = {{
def _js_str(s: str) -> str:
"""Escape a Python string for embedding as a JS string literal."""
import json
return json.dumps(s)