Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
6.3 KiB
6.3 KiB
Review Report (Round 2): Issue #60 (fix/issue-60-opencode-v2)
- Job ID:
c9d06e85 - Reviewer:
herdr:reviewer-agy-01(agy) - Commit Range:
74333f87d0c02888c2b5b281e912d97e74348c01..cb5f439cce41a2741a6b9974a308a765e50f00ad(4 commits; Round 2 delta:6b4b96fa1875862ef3bed830fe7b04166b1fad58..cb5f439cce41a2741a6b9974a308a765e50f00ad, 1 commit) - Verification Worktree:
/var/folders/q_/68sxgw3j073dgjg8wl9s08vw0000gn/T/mam-review/loop-20261018T064723Z-79133f/1 - Host / Runtime: macOS
arm64-apple-darwin25(Darwin 25.3.0),/usr/bin/python33.9.6 &.venv/bin/python3.9.6,/bin/bash3.2.57,opencodev2.0.32 (/Users/godopu16/.opencode/bin/opencode)
1. Round 1 Findings Verification (6b4b96f..cb5f439)
All five Round 1 items addressed in commit cb5f439 work as designed and their new tests fail against pre-fix Round 1 code (6b4b96f):
- [Resolved — Child session 1.x row purge & residual reporting (
_descendants,_LEGACY_TABLES)]:.agents/skills/lib_py/agents/adapters/opencode.py:160-222resolves all descendant session IDs (_descendants(db, uuid), walkingparent_idacross bothsession_v2and 1.xsessiontables to arbitrary depth with cycle protection in read-only mode) before callingopencode session delete --standalone -- <uuid>.purge_artifactsthen deletes rows for[uuid] + descendantsacross all 1.x legacy tables (_LEGACY_TABLES:message,messages,part,parts,todo,session_share,session,sessions).residual_artifacts(.agents/skills/lib_py/agents/adapters/opencode.py:229-238) checks[uuid] + self._descendants(db, uuid)and tags surviving descendant rows with[child session <id>].
- [Resolved —
conversation_in_useignores backgroundserve --servicedaemon]:.agents/skills/lib_py/agents/adapters/opencode.py:240-262checksconversation_in_use(uuid, [])first, then inspectslsof -t <db>PIDs viaps -o command= -p <pid>and ignores processes withserve --servicein their command line while still treating--standaloneTUI/server holders as in-use (and failing safe toTrueonlsof/pserrors).
- [Resolved —
XDG_DATA_HOMEhandling in_data_home(ctx)]:.agents/skills/lib_py/agents/adapters/opencode.py:89-99uses the caller'sXDG_DATA_HOMEwhenctx.home_dirresolves toos.path.expanduser("~")(or is empty), and<ctx.home_dir>/.local/sharewhenctx.home_diris a separate directory.
- [Resolved —
resident_children = ('opencode',)]:.agents/skills/lib_py/agents/adapters/opencode.py:72-76declaresresident_children = ('opencode',), sostall_watch.background_childrenskips the idleopencode serve --stdio --port 0child while still walking any tool subprocesses spawned beneath it.
- [Resolved — Test coverage & pre-fix failure check]:
test_real_opencode_2x_contractbindsadapter._bintoREAL(noPATHdependency), andtest_comp_opencode_create_and_reconcile_and_stop(tests/test_tier2_component.py:1252-1273) verifies thatreconcile.shdrift C pins the top-level session rather than a newer child session in the same directory.- Running the 5 new tests in
tests/test_issue60_opencode_v2.pyagainst Round 1 commit6b4b96fin an isolated/tmpcopy fails all 5 (5 failed, 10 deselected).
2. Issue Blocking Merge
[P1] tests/test_issue55_agent_homes.py::test_l1_every_path_variable_the_code_reads_is_accounted_for fails (XDG_DATA_HOME missing from tests/_agent_home_guard.py)
- Location:
tests/_agent_home_guard.py:21(triggered by.agents/skills/lib_py/agents/adapters/opencode.py:94readingos.environ.get("XDG_DATA_HOME")) - Symptom:
FAILED tests/test_issue55_agent_homes.py::test_l1_every_path_variable_the_code_reads_is_accounted_for AssertionError: path variables the adapters/lib.sh read but conftest._isolate_agent_homes does not drop: ['XDG_DATA_HOME'] - Root Cause & Linux Isolation Impact:
test_issue55_agent_homes.pyscans.agents/skills/lib_py/agents/*.py,lib_py/paths.py, andlib.shfor any*_DIR/*_HOMEenvironment variable read by the adapters and requires every such variable to be accounted for intests/_agent_home_guard.py(DROPPED_VARSorLEFT_ALONE).- Furthermore,
XDG_DATA_HOMEmust be inDROPPED_VARS(notLEFT_ALONE): inopencode.py:95,own = os.path.realpath(ctx.home_dir or "") == os.path.realpath(os.path.expanduser("~")). When a test isolatesHOMEviamonkeypatch.setenv("HOME", str(tmp_path))(such asmam_sandbox),os.path.expanduser("~")equalsctx.home_dir(ownisTrue). On a Linux machine whereXDG_DATA_HOMEis set in the outer shell environment, ifconftest._isolate_agent_homesdoes not dropXDG_DATA_HOME,_data_home(ctx)would use the outer environment's realXDG_DATA_HOMEinstead of<tmp_path>/.local/share!
- Required Fix:
Add
"XDG_DATA_HOME"toDROPPED_VARSintests/_agent_home_guard.py:21(and optionally honourambient.get("XDG_DATA_HOME")for"opencode"inwatch_dirs(ambient)attests/_agent_home_guard.py:48):(Verified in an isolatedDROPPED_VARS = ("HOME_DIR", "CLAUDE_PROJECT_DIR", "CLAUDE_CONFIG_DIR", "CODEX_HOME", "XDG_DATA_HOME", "LOCAL_BIN")/tmpcopy: adding"XDG_DATA_HOME"toDROPPED_VARSmakes bothtests/test_issue55_agent_homes.py(11/11) andtests/test_issue60_opencode_v2.py(15/15, includingtest_the_data_dir_follows_the_callers_xdg_data_home_only_for_its_own_homewhich setsXDG_DATA_HOMEinside the test) pass cleanly).
3. Verification Summary
tests/test_issue60_opencode_v2.py: 15 passed (includingtest_real_opencode_2x_contractagainstopencode v2.0.32)tests/test_a4_adapter_contract.py: 33 passedtests/test_tier2_component.py -k opencode: 1 passed (test_comp_opencode_create_and_reconcile_and_stop)tests/test_issue31_purge_residual.py -k opencode: 1 passed (test_opencode_purge_leaves_no_rows)tests/test_issue55_agent_homes.py: 10 passed, 1 failed (test_l1_every_path_variable_the_code_reads_is_accounted_for)- Verification worktree
/var/folders/q_/68sxgw3j073dgjg8wl9s08vw0000gn/T/mam-review/loop-20261018T064723Z-79133f/1verified clean (git status -sempty, no.mamdirectory created).
[VERDICT: NOT PASS]