mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: sort AI sessions by last prompt time (#24440)
Previously, the sessions list sorted by `MIN(started_at)` across interceptions, so sessions with old start times but recent activity would sink to the bottom of the list regardless of how recently they were used. `ListAIBridgeSessions` now sorts by `COALESCE(MAX(prompt.created_at), MIN(started_at)) DESC`, exposed as the non-nullable `last_active_at` field. Sessions with prompts surface by last activity; sessions with no prompts fall back to their start time. The original implementation used two separate columns (`last_active_at` as a nullable prompt timestamp and `sort_at` as the non-nullable cursor key). This revision collapses them into a single `last_active_at` that is always set — simplifying the SQL, the Go conversion, the API type, and the frontend. 🤖 Generated with [Claude Code](https://claude.ai/claude-code) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
60186b2489
commit
c23abc691f
Generated
+1
@@ -214,6 +214,7 @@ curl -X GET http://coder-server:8080/api/v2/aibridge/sessions \
|
||||
"name": "string",
|
||||
"username": "string"
|
||||
},
|
||||
"last_active_at": "2019-08-24T14:15:22Z",
|
||||
"last_prompt": "string",
|
||||
"metadata": {
|
||||
"property1": null,
|
||||
|
||||
Generated
+3
@@ -690,6 +690,7 @@
|
||||
"name": "string",
|
||||
"username": "string"
|
||||
},
|
||||
"last_active_at": "2019-08-24T14:15:22Z",
|
||||
"last_prompt": "string",
|
||||
"metadata": {
|
||||
"property1": null,
|
||||
@@ -824,6 +825,7 @@
|
||||
"name": "string",
|
||||
"username": "string"
|
||||
},
|
||||
"last_active_at": "2019-08-24T14:15:22Z",
|
||||
"last_prompt": "string",
|
||||
"metadata": {
|
||||
"property1": null,
|
||||
@@ -854,6 +856,7 @@
|
||||
| `ended_at` | string | false | | |
|
||||
| `id` | string | false | | |
|
||||
| `initiator` | [codersdk.MinimalUser](#codersdkminimaluser) | false | | |
|
||||
| `last_active_at` | string | false | | |
|
||||
| `last_prompt` | string | false | | |
|
||||
| `metadata` | object | false | | |
|
||||
| » `[any property]` | any | false | | |
|
||||
|
||||
Reference in New Issue
Block a user