-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(coderd): exclude accounting rows from chat history_version #26689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b7f470f
3cb7a48
0bc176d
5c8af68
313f8b7
5d0a775
dc93f55
877bbf0
2cf46f3
785ef29
6e41150
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| -- Drop the view before the columns it references, then recreate it without | ||
| -- the summary columns, matching the pre-000534 chats_expanded definition. | ||
| DROP VIEW IF EXISTS chats_expanded; | ||
|
|
||
| ALTER TABLE chats | ||
| DROP COLUMN summary, | ||
| DROP COLUMN summary_generated_at; | ||
|
|
||
| CREATE VIEW chats_expanded AS | ||
| SELECT c.id, | ||
| c.owner_id, | ||
| c.workspace_id, | ||
| c.title, | ||
| c.status, | ||
| c.worker_id, | ||
| c.started_at, | ||
| c.heartbeat_at, | ||
| c.created_at, | ||
| c.updated_at, | ||
| c.parent_chat_id, | ||
| c.root_chat_id, | ||
| c.last_model_config_id, | ||
| c.archived, | ||
| c.last_error, | ||
| c.mode, | ||
| c.mcp_server_ids, | ||
| c.labels, | ||
| c.build_id, | ||
| c.agent_id, | ||
| c.pin_order, | ||
| c.last_read_message_id, | ||
| c.dynamic_tools, | ||
| c.organization_id, | ||
| c.plan_mode, | ||
| c.client_type, | ||
| c.last_turn_summary, | ||
| c.snapshot_version, | ||
| c.history_version, | ||
| c.queue_version, | ||
| c.generation_attempt, | ||
| c.retry_state, | ||
| c.retry_state_version, | ||
| c.runner_id, | ||
| c.requires_action_deadline_at, | ||
| COALESCE(root.user_acl, c.user_acl) AS user_acl, | ||
| COALESCE(root.group_acl, c.group_acl) AS group_acl, | ||
| owner.username AS owner_username, | ||
| owner.name AS owner_name, | ||
| c.context_aggregate_hash, | ||
| c.context_dirty_since, | ||
| c.context_dirty_resources, | ||
| c.context_error | ||
| FROM ((chats c | ||
| LEFT JOIN chats root ON ((root.id = COALESCE(c.root_chat_id, c.parent_chat_id)))) | ||
| JOIN visible_users owner ON ((owner.id = c.owner_id))); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| -- Add the persisted whole-chat summary and its freshness marker. The summary | ||
| -- is generated in the background after successful turns and is distinct from | ||
| -- last_turn_summary, which only reflects the most recent turn. | ||
| ALTER TABLE chats | ||
| ADD COLUMN summary TEXT, | ||
| ADD COLUMN summary_generated_at TIMESTAMPTZ; | ||
|
|
||
| -- Recreate chats_expanded so the new chat columns are exposed to the API. The | ||
| -- view has an explicit column list, so new columns are otherwise invisible. | ||
| -- summary and summary_generated_at are placed next to last_turn_summary. | ||
| DROP VIEW IF EXISTS chats_expanded; | ||
|
|
||
| CREATE VIEW chats_expanded AS | ||
| SELECT c.id, | ||
| c.owner_id, | ||
| c.workspace_id, | ||
| c.title, | ||
| c.status, | ||
| c.worker_id, | ||
| c.started_at, | ||
| c.heartbeat_at, | ||
| c.created_at, | ||
| c.updated_at, | ||
| c.parent_chat_id, | ||
| c.root_chat_id, | ||
| c.last_model_config_id, | ||
| c.archived, | ||
| c.last_error, | ||
| c.mode, | ||
| c.mcp_server_ids, | ||
| c.labels, | ||
| c.build_id, | ||
| c.agent_id, | ||
| c.pin_order, | ||
| c.last_read_message_id, | ||
| c.dynamic_tools, | ||
| c.organization_id, | ||
| c.plan_mode, | ||
| c.client_type, | ||
| c.last_turn_summary, | ||
| c.summary, | ||
| c.summary_generated_at, | ||
| c.snapshot_version, | ||
| c.history_version, | ||
| c.queue_version, | ||
| c.generation_attempt, | ||
| c.retry_state, | ||
| c.retry_state_version, | ||
| c.runner_id, | ||
| c.requires_action_deadline_at, | ||
| COALESCE(root.user_acl, c.user_acl) AS user_acl, | ||
| COALESCE(root.group_acl, c.group_acl) AS group_acl, | ||
| owner.username AS owner_username, | ||
| owner.name AS owner_name, | ||
| c.context_aggregate_hash, | ||
| c.context_dirty_since, | ||
| c.context_dirty_resources, | ||
| c.context_error | ||
| FROM ((chats c | ||
| LEFT JOIN chats root ON ((root.id = COALESCE(c.root_chat_id, c.parent_chat_id)))) | ||
| JOIN visible_users owner ON ((owner.id = c.owner_id))); |
Uh oh!
There was an error while loading. Please reload this page.