Bind archived filter as bool in ListTasks #65

Merged
weichen merged 1 commits from feature/store-pg-archived-literal into main 2026-10-05 03:21:13 +00:00
Owner

Summary

  • ListTasks no longer appends the SQL literal AND archived=0. The default unarchived view binds archived=? to a Go false, which PostgreSQL accepts on a BOOLEAN column and SQLite still stores as 0/1.
  • openTestStore builds search_path for both URL DSNs (with or without an existing query) and keyword DSNs, and keeps public so an already-installed pg_trgm stays visible.

Why

GET /api/conversations (includeArchived=false) hit boolean = integer (SQLSTATE 42883) on the postgres tier and the handler returned 500. The previous dialect fix covered parameter binding and scans, not this literal.

Evidence

  • Before: TestConversationFlagsAndTaskList with AGENT_PG_TEST_DSN pointed at pg1 failed with operator does not exist: boolean = integer (SQLSTATE 42883).
  • After: same test and go test ./internal/store -count=1 passed on pg1. go vet ./... && go test ./... -count=1 passed on SQLite.

Test plan

  • SQLite go vet ./... && go test ./... -count=1
  • pg1 AGENT_PG_TEST_DSN=<pg1> go test ./internal/store -count=1
  • After the Dev gitlink bump is deployed: GET /api/conversations returns 200

Refs: Agent-System-Dev feature/store-pg-archived-literal

## Summary - `ListTasks` no longer appends the SQL literal `AND archived=0`. The default unarchived view binds `archived=?` to a Go `false`, which PostgreSQL accepts on a BOOLEAN column and SQLite still stores as 0/1. - `openTestStore` builds `search_path` for both URL DSNs (with or without an existing query) and keyword DSNs, and keeps `public` so an already-installed `pg_trgm` stays visible. ## Why `GET /api/conversations` (includeArchived=false) hit `boolean = integer` (SQLSTATE 42883) on the postgres tier and the handler returned 500. The previous dialect fix covered parameter binding and scans, not this literal. ## Evidence - Before: `TestConversationFlagsAndTaskList` with `AGENT_PG_TEST_DSN` pointed at pg1 failed with `operator does not exist: boolean = integer (SQLSTATE 42883)`. - After: same test and `go test ./internal/store -count=1` passed on pg1. `go vet ./... && go test ./... -count=1` passed on SQLite. ## Test plan - [x] SQLite `go vet ./... && go test ./... -count=1` - [x] pg1 `AGENT_PG_TEST_DSN=<pg1> go test ./internal/store -count=1` - [ ] After the Dev gitlink bump is deployed: `GET /api/conversations` returns 200 Refs: Agent-System-Dev feature/store-pg-archived-literal
weichen added 1 commit 2026-10-05 03:18:35 +00:00
Bind archived filter as bool in ListTasks
ci / vet-and-test (pull_request) Successful in 41s
8d82408bb7
Why: GET /api/conversations on the default unarchived view appended
AND archived=0. PostgreSQL stores conversations.archived as BOOLEAN
and rejects boolean = integer (42883), so listTasks returned 500.
The previous dialect fix bound parameters and scans but left this literal.

Evidence: before the change, TestConversationFlagsAndTaskList against
pg1 failed with SQLSTATE 42883. After: AGENT_PG_TEST_DSN set to pg1,
go test ./internal/store -count=1 passed; go vet ./... && go test ./...
passed on SQLite.

Impact: the default task list works on the postgres tier. SQLite still
binds the bool as 0/1. openTestStore accepts URL and keyword DSNs and
keeps public on search_path so an existing pg_trgm extension stays visible.

Refs: Agent-System-Dev feature/store-pg-archived-literal
Co-authored-by: Cursor <cursoragent@cursor.com>
weichen merged commit 4136bdcbbb into main 2026-10-05 03:21:13 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Backend#65