Skip to content

refactor: stop storing gateway key IDs#27171

Draft
ibetitsmike wants to merge 1 commit into
mike/chat-synthetic-keys/synthetic-keysfrom
mike/chat-synthetic-keys/stop-legacy-storage
Draft

refactor: stop storing gateway key IDs#27171
ibetitsmike wants to merge 1 commit into
mike/chat-synthetic-keys/synthetic-keysfrom
mike/chat-synthetic-keys/stop-legacy-storage

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Mux is working on behalf of Mike.

Summary

Stop reading and writing the legacy api_key_id columns on chat messages and queued messages. Runtime AI Gateway attribution continues to use the per-user synthetic key introduced by #27170.

The nullable text columns remain for rolling deployment compatibility, but #27170 has already removed their foreign keys. Any IDs stamped by older replicas remain inert. This PR must be fully deployed before #27172.

Depends on #27170.

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

Mux is working on behalf of Mike.

Dogfood migration UAT passed.

The preserved database was then migrated to #27172 successfully.

@ibetitsmike ibetitsmike changed the title refactor(coderd/x/chatd): stop storing gateway key IDs refactor: stop storing gateway key IDs Jul 10, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 6635cd273b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike ibetitsmike force-pushed the mike/chat-synthetic-keys/synthetic-keys branch from dbede83 to edea7df Compare July 10, 2026 18:21
@ibetitsmike ibetitsmike force-pushed the mike/chat-synthetic-keys/stop-legacy-storage branch from 6635cd2 to 7557de2 Compare July 10, 2026 18:21
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 7557de2cfd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike ibetitsmike force-pushed the mike/chat-synthetic-keys/synthetic-keys branch from edea7df to ab1009d Compare July 10, 2026 19:01
@ibetitsmike ibetitsmike force-pushed the mike/chat-synthetic-keys/stop-legacy-storage branch 2 times, most recently from 2a464a3 to e6a9d4f Compare July 10, 2026 19:23
@ibetitsmike ibetitsmike force-pushed the mike/chat-synthetic-keys/synthetic-keys branch from ab1009d to 500b588 Compare July 10, 2026 19:37
@ibetitsmike ibetitsmike force-pushed the mike/chat-synthetic-keys/stop-legacy-storage branch from e6a9d4f to 21f7269 Compare July 10, 2026 19:37
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 21f726957a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

Mux is working on behalf of Mike.

Final-stack targeted dogfood passed after the FK-decoupling fix.

  • PR1 head 500b588185: both legacy API-key FKs were absent. Deleting the mapped synthetic key during an active generation left history_version, queue_version, and generation_attempt unchanged at deletion time. The generation completed normally, compatibility text IDs remained, and the next turn reminted a new synthetic key.
  • PR2 head 21f726957a: the preserved PR1 chat loaded, a new FINAL-PR2 chat completed, legacy columns remained nullable and unwritten, and the FKs remained absent.
  • PR3 head 2de350aa78: preserved PR1 and PR2 chats loaded, a new FINAL-PR3 chat completed, and the legacy columns and FKs were absent.

This supplements the earlier full UI/API/database UAT and validates the final rewritten stack heads.

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