Skip to content

fix(opencode): repair missing account.org_id column on startup#16382

Closed
SergioChan wants to merge 18 commits intoanomalyco:betafrom
SergioChan:fix/16378-account-orgid-repair
Closed

fix(opencode): repair missing account.org_id column on startup#16382
SergioChan wants to merge 18 commits intoanomalyco:betafrom
SergioChan:fix/16378-account-orgid-repair

Conversation

@SergioChan
Copy link

@SergioChan SergioChan commented Mar 6, 2026

Issue for this PR

Closes #16378

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Some beta users have an existing account table without the newer org_id column, which causes startup queries like active() to fail with SQLiteError: no such column: account.org_id.

This adds a small startup schema repair in Database.Client:

  • after normal migrations run, check whether account exists
  • if org_id is missing, run ALTER TABLE account ADD COLUMN org_id text

This is idempotent and only applies to affected legacy databases.

How did you verify your code works?

I validated the migration-repair path by code inspection against the issue stack trace and the current beta migration sequence (20260228203230_blue_harpoon introduces org_id).

I could not run the local Bun test/build commands in this environment because bun is not installed in the runner (/bin/bash: bun: command not found).

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@SergioChan
Copy link
Author

Thanks for the compliance check. I can't run Bun locally in this environment (bun is unavailable), so I left the local-test checklist item unchecked intentionally and documented the constraint in the PR.\n\nValidation available for this change:\n- reproduction linkage: issue stack trace shows startup failure on missing account.org_id\n- fix scope: startup-only idempotent schema repair when column is missing\n- CI: current PR checks are passing\n\nIf you'd prefer a different checklist handling for constrained environments, I can update the PR description format accordingly.

@SergioChan SergioChan force-pushed the fix/16378-account-orgid-repair branch from bad6714 to 7723159 Compare March 6, 2026 18:56
@opencode-agent opencode-agent bot force-pushed the beta branch 2 times, most recently from 7c70fd0 to a12fce4 Compare March 6, 2026 20:20
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 6, 2026
@github-actions github-actions bot closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant