Skip to content

fix(ci): check-duplicates job crashes — session.data undefined #122

Description

@terisuke

Summary

The check-duplicates CI job fails on every PR with a TypeError in the duplicate PR detection script.

Error

TypeError: undefined is not an object (evaluating 'session.data.id')
  at main (/home/runner/work/opencode/opencode/script/duplicate-pr.ts:64:29)

Root Cause

The script at script/duplicate-pr.ts calls opencode.client.session.create() which returns session.data as undefined. This happens because:

  1. The CI environment likely lacks a valid OPENCODE_API_KEY
  2. The session creation fails silently, returning { data: undefined }
  3. The script doesn't handle the undefined case before accessing .id

Impact

  • Every PR shows check-duplicates as failed
  • This is cosmetic noise — it does not affect code quality checks
  • May desensitize developers to CI failures ("oh that always fails")

Fix Options

  1. Add null check: if (!session.data) { console.log('No session — skipping duplicate check'); process.exit(0); }
  2. Set OPENCODE_API_KEY as a GitHub Actions secret
  3. Make the job continue-on-error: true as interim measure

Evidence

CI logs from PR #117:

62 |     const result = await opencode.client.session
63 |       .prompt({
64 |         path: { id: session.data!.id },
                                 ^
TypeError: undefined is not an object (evaluating 'session.data.id')

Ref

Observed on all PRs since at least PR #113

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions