Skip to content

feat(trace): e2e adapter for OpenCode 2 - #3662

Merged
jiparis merged 4 commits into
chainloop-dev:mainfrom
jiparis:feat/trace-e2e-opencode
Oct 19, 2026
Merged

jiparis merged 4 commits into
chainloop-dev:mainfrom
jiparis:feat/trace-e2e-opencode

Conversation

@jiparis

@jiparis jiparis commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Part of #3635 (spec issue-3635). Adds the OpenCode 2 column to the Chainloop Trace end-to-end suite.

  • An OpenCode adapter runs opencode run --standalone with the JSON output and auto-approved tools. Each session gets a private server, because the shared background server keeps the environment and the plugins of the folder that started it.
  • OpenCode takes its project folder from PWD, not from the working folder of the process. The adapter sets PWD to the workspace. As a guard, the suite now fails when the HEAD of the checkout that runs it changes during a run.
  • The Trace plugin posts the instruction and the reminder to the session as synthetic messages. The adapter exports the session after the run and reads them from the export.
  • The suite runs the harnesses that config.yaml lists. OpenCode 2 is pinned to 2.0.22 with openrouter/anthropic/claude-haiku-5.5, which needs OPENROUTER_API_KEY. The adapter returns an error when the installed major version is not the one of the column. OpenCode 1.x is not configured yet.
  • The harness gives the path of the skill files, and the file of the user hook when it is not the file of the Chainloop hooks. For OpenCode, the Chainloop plugin and the user plugin are separate files.
  • The check of allow markers reports "not covered" when the stored session holds no copy of the fixture line: the OpenCode transcript has no tool outputs.
  • The model check accepts a provider prefix in the configured model name.
  • The ticket prompt asks for the file tool and a separate commit command, and the media prompt tells the agent not to capture the image. Without this, some runs tested the model's choices, not the feature.
  • The README marks the OpenCode 2 cells that the suite verified as Yes: hook installation and deletion, trace run wrapper, missed session start, and spec source role, title, and description.

AI disclosure: Claude Code helped to write this change.

Add the OpenCode 2 harness to the Trace end-to-end suite. The suite runs
the harnesses that config.yaml lists. The skill files and the user hook
file come from the harness, and the suite fails when an agent commits in
the checkout that runs it.

Assisted-by: Claude Code
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>

Chainloop-Trace-Sessions: be5af72c-30e7-48f4-b46c-dc7a5a754c41
@chainloop-platform

chainloop-platform Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ✅ 3 passing

Status Policy Material Messages
✅ Passed pr-min-approvals pr-info -
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — ⚠️ no AI session found

Missing AI Coding Sessions

This organization requires every PR to be backed by a Chainloop Trace AI coding session, and none was found for this one.

Please make sure the AI coding session evidence has been sent by the Chainloop CLI, or add the skip-ai-session label to this PR to bypass this check.

Learn more about Chainloop Trace.

Security Checks — ⚠️ 3 failing

✅ secret-scan

Status Policy Messages
✅ Passed secrets-detection -

⚠️ sast-scan — 3 failing

Status Policy Messages
⚠️ Failed owasp-top10-2025 Weakness from OWASP Top 10 found: CWE-94, "Improper Control of Generation of Code ('Code Injection')" (A05:2025 – Injection)
⚠️ Failed sast (error) app/cli/internal/trace/e2e/opencode.go:74: Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user data can reach this call site, this is a code injection vulnerability. A malicious actor can inject a malicious script to execute arbitrary code.
⚠️ Failed cwe-top25 Weakness from CWE Top 25 found: CWE-94, "Improper Control of Generation of Code ('Code Injection')"
✅ Passed cwe-top26-40-cusp -

✅ iac-scan

Status Policy Messages
✅ Passed iac-misconfiguration -
Scans not applied (2)
Scan Reason
vulnerability-scan no manifest/lockfile changed
github-actions-scan no workflow files changed

View attestation ↗

Security context

✅ Nothing this change touches has a recorded security-fix history.

View in Chainloop ↗ · How this works ↗


Powered by Chainloop and Chainloop Trace

migmartri
migmartri previously approved these changes Oct 19, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 12 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread app/cli/internal/trace/README.md
The ticket prompt asks for the file tool and a separate commit command:
a commit in the shell command that writes the file does not carry the
session. The media prompt tells the agent not to capture the image, which
would replace its base64 in the transcript with a pointer.

Assisted-by: Claude Code
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>

Chainloop-Trace-Sessions: be5af72c-30e7-48f4-b46c-dc7a5a754c41
The harness map is used only by the e2e test, so a lint run without the
e2e tag reported it as unused.

Assisted-by: Claude Code
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>

Chainloop-Trace-Sessions: be5af72c-30e7-48f4-b46c-dc7a5a754c41
@jiparis
jiparis requested a review from migmartri October 19, 2026 19:47
@jiparis
jiparis merged commit 219e15c into chainloop-dev:main Oct 19, 2026
15 of 17 checks passed
@jiparis
jiparis deleted the feat/trace-e2e-opencode branch October 19, 2026 20:51
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.

2 participants