Commit Graph
1 Commits
Author SHA1 Message Date
g-but 07549afd2d feat(db): prompt queue moves from /tmp file to project_states.prompt_queue column
Closes the queue-storage gap raised in last turn's evaluation. Before:
the per-project prompt queue lived in /tmp/agent-queue-<tab>, which is
ephemeral on Vercel (lost on cold start) and not user-scoped. After:
project_states.prompt_queue (text[] not null default '{}') is the
source of truth — persists across browsers, Vercel cold starts, and
backed by the same per-(user, project) PK as the rest of session
state.

Files touched:
  • drizzle/0010_project_states_prompt_queue.sql — ADD COLUMN IF
    NOT EXISTS text[] not null default '{}'. Applied to both Neon
    prod and local Postgres via psql.
  • src/db/schema/project-states.ts — promptQueue field added next
    to sessionStatus (also new this week, similar shape).
  • src/app/api/beacon/queue/[tab]/route.ts — rewritten to read/
    write the DB row. Adds proper auth (was unauthenticated; closed
    a real auth gap on the way through). Keeps a best-effort file
    mirror so scripts/agent-hook-bridge.sh's two /tmp/agent-queue-*
    readers don't break (user has denied prior edits to that file
    3x — file mirror stays until that path is touched).

Auth note: the old route had NO auth check. Any unauthenticated
caller could read or overwrite any tab's queue. usePromptQueue is the
only consumer in the codebase and runs in an authed session, so the
new 401 doesn't break any production flow.

What's NOT in this commit (deliberate scope cut):
  • The bash hook's two /tmp readers. Long-term they should query
    the DB via authed API — that's a separate ticket since user has
    repeatedly denied agent-hook-bridge.sh edits.

tsc clean, eslint clean, npm run test:home 85/85.
2026-05-20 11:22:34 +02:00