Skip to content

fix(opencode): attribute sessions by agent id#1506

Merged
Haz3-jolt merged 1 commit into
BlazeUp-AI:mainfrom
Haz3-jolt:fix/opencode-agent-id-attribution
Jun 23, 2026
Merged

fix(opencode): attribute sessions by agent id#1506
Haz3-jolt merged 1 commit into
BlazeUp-AI:mainfrom
Haz3-jolt:fix/opencode-agent-id-attribution

Conversation

@Haz3-jolt

@Haz3-jolt Haz3-jolt commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Purpose / Description

OpenCode session traces were not being populated because the CLI could install only an offline stub plugin, and auth login skipped OpenCode when the binary lived at ~/.opencode/bin/opencode instead of on PATH.

This PR moves OpenCode attribution to the harness-native active agent signal, resolves that name through the Observal lockfile, and sends the lockfile agent id and version to ingest.

Fixes

  • Fixes: N/A, no issue number provided

Approach

  • Move the real OpenCode telemetry plugin source into observal_shared so both CLI and server use one copy.
  • Remove OpenCode plugin content from generated agent install snippets, since the plugin is installed by auth login or doctor patch, not per agent pull.
  • Make observal auth login detect the official ~/.opencode/bin/opencode install path.
  • Add OpenCode plugin version and content hash drift checks in doctor.
  • Update doctor patch --all --harness opencode to install or update the plugin only when content differs.
  • Attribute OpenCode sessions by active OpenCode agent name, then look up id and version from ~/.observal/lockfile.json.

How Has This Been Tested?

image

Learning (optional, can help others)

OpenCode stores sessions in SQLite at ~/.local/share/opencode/opencode.db, not JSONL. The plugin uses OpenCode runtime events and client APIs to export message objects into JSONL-compatible ingest lines.

The active top-level OpenCode session records an agent name, not an Observal UUID, so the reliable path is:

OpenCode active agent name -> Observal lockfile lookup -> agent id/version

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)

AI Assistance

Was generative AI tooling used to co-author this PR?

  • Yes(Please Specify the tool): Pi coding agent
  • Was the generated code manually reviewed and tested?

@github-actions github-actions Bot added cli CLI changes server Pull request touches server code tests Pull request adds or modifies tests labels Jun 23, 2026
Co-authored-by: Subramania Raja <dhanpraja231@users.noreply.github.com>
@Haz3-jolt Haz3-jolt force-pushed the fix/opencode-agent-id-attribution branch from fc9abcd to 9f4f34a Compare June 23, 2026 16:34
@Haz3-jolt Haz3-jolt merged commit 38c5ddc into BlazeUp-AI:main Jun 23, 2026
19 checks passed
@Haz3-jolt Haz3-jolt deleted the fix/opencode-agent-id-attribution branch June 23, 2026 16:38
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.86207% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
observal_cli/cmd_doctor.py 86.36% 3 Missing ⚠️
observal-server/services/harness/helpers.py 0.00% 2 Missing ⚠️
observal_cli/cmd_auth.py 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

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

Labels

cli CLI changes server Pull request touches server code tests Pull request adds or modifies tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant