Files
goclaw/migrations/000030_jsonb_gin_indexes.up.sql
viettranx 74dc086a80 fix(providers): post-merge fixes for Codex OAuth pools (#450)
- fix Rules of Hooks violation in chatgpt-oauth-routing-section
- add stale-while-revalidate with atomic dedup for RouteEligibility
- move raw SQL from HTTP handler to TracingStore.ListCodexPoolSpans
- persist round-robin state in Registry shared counter
- extract duplicated frontend helpers to agent-display-utils
- split oversized frontend files (964→214 lines max)
- add GIN indexes for spans.metadata and sessions.metadata
- fix tenant-aware provider lookup in handleQuota
- separate empty-role vs error handling in resolveTenantHint
- scope pool validation to chatgpt_oauth providers only
- wrap buildEntries in useCallback for stable useMemo deps
- document OAuth concurrent auth limitation and RoleAdmin breaking change
2026-03-27 10:19:16 +07:00

15 lines
751 B
SQL

-- GIN indexes for JSONB columns that are actively queried with -> / ->> operators.
-- Audit found 0 existing GIN indexes on 30+ JSONB columns.
-- spans.metadata: used for cache token aggregation (tracing.go, snapshot_worker.go)
-- and chatgpt_oauth_routing evidence queries (agents_codex_pool_activity.go).
-- Partial index on span_type = 'llm_call' to reduce INSERT overhead on high-volume table.
CREATE INDEX IF NOT EXISTS idx_spans_metadata_gin
ON spans USING GIN (metadata)
WHERE span_type = 'llm_call';
-- sessions.metadata: used for chat_title filtering in pending message lookups
-- (pending_message_store.go) and heartbeat queries (heartbeat.go).
CREATE INDEX IF NOT EXISTS idx_sessions_metadata_gin
ON sessions USING GIN (metadata);