Skip to content

fix(harness): correct OpenCode v2 errors and command handling - #1

Closed
tbrandenburg wants to merge 1 commit into
philo-x:codex/opencode-v2-compatibilityfrom
tbrandenburg:fix/pr3367-verification
Closed

tbrandenburg wants to merge 1 commit into
philo-x:codex/opencode-v2-compatibilityfrom
tbrandenburg:fix/pr3367-verification

Conversation

@tbrandenburg

Copy link
Copy Markdown

Summary

Follow-up fixes for dagucloud#3367. This PR targets your codex/opencode-v2-compatibility branch so it can be merged into the existing contribution without duplicating its changes upstream.

Based on 85e9c8b; one additional commit, four changed files. You can merge this PR or cherry-pick ca66e59161c405aa508fe38b2f47ce42937a77dd.

Changes

  • Decode v2 404 error tags instead of treating every session-scoped 404 as a missing session. Unknown commands/models and missing locations now remain execution errors; actual missing sessions retain the unavailable state, including interaction and message-history requests. V1 mapping is unchanged.
  • Preserve assistant snapshot.files as a stable patch event for the existing timeline and changed-file previews.
  • Let v2 command preparation use the workflow context deadline instead of the generic 30-second HTTP timeout, matching the v1 command path.
  • Add regressions for typed and malformed 404 responses, changed-file metadata, slow commands, and cancellation after command acknowledgement.
  • Extend real-v2 verification with a command containing a 31-second shell substitution and an unknown command that fails while its session remains available.
  • Link managed OpenCode documentation from the README action table.

Related Issues

Related to dagucloud#3367; this is not a replacement for or closure of that PR.

Validation

The snapshot, error-classification, and slow-command regression tests failed against the original implementation before applying the fixes.

Passed locally:

go test -race ./internal/opencodehost ./internal/runtime/builtin/harness ./internal/cmn/config
go test -race ./internal/runtime/builtin/harness -run '^TestV2(Snapshot|NotFound|SlowCommand|AdmittedCancellation|CommandCancellation)$' -count=10
go vet ./internal/opencodehost ./internal/runtime/builtin/harness ./internal/cmn/config
go fix -embedlit=false -diff ./internal/opencodehost ./internal/runtime/builtin/harness ./internal/cmn/config
git diff --check

Formatting checks for the three modified Go files produced no differences.

Real OpenCode v2.1.4 verification, including prompt, template command, slow command, unknown command, permission approval, question answer/resume, and deletion, passed with race detection:

npm ci --prefix .github/opencode --no-audit --no-fund
DAGU_TEST_OPENCODE_V2_EXECUTABLE="$PWD/.github/opencode/node_modules/@opencode/cli-linux-x64-baseline/bin/opencode" \
  go test -race ./internal/runtime/builtin/harness -run '^TestRealV2Run$' -count=1 -v

Latest result: PASS, package time 43.827s.

Validation limits: repository-wide make fmt timed out during go fix; broad lint was not completed. Harness conformance timed out building the binary before running tests. Real v1.18.11 verification repeatedly failed during startup/preflight before adapter execution; its root cause remains unresolved. No full-suite or real-v1 compatibility claim is made.

Checklist

  • Repository-wide style/lint validation completed
  • Self-review of the code has been performed
  • Tests have been added or updated as needed
  • Documentation has been updated as needed
  • Changes have been tested locally with the scoped checks above

Distinguish missing sessions from other v2 404 responses and retain snapshot file changes in the timeline. Let command preparation follow the workflow deadline rather than the generic HTTP timeout.

Add regression coverage and extend real-v2 verification with a slow command and an unknown command. Follow-up to dagucloud#3367.
@tbrandenburg

Copy link
Copy Markdown
Author

@coderabbitai review

@tbrandenburg

Copy link
Copy Markdown
Author

Sorry for leaving this outdated handoff open after the upstream changes. I have adapted and verified the remaining typed-404 and snapshot fixes against current upstream main in dagucloud#3466. The command-timeout change is intentionally excluded to preserve the newer submission/cancellation guarantees. Closing this handoff in favor of that focused upstream replacement; the original branch and commit are retained. Thank you for the compatibility work.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant