Summary
operator_queue.id is a TEXT PRIMARY KEY shared fleet-wide; the create path uses on_conflict_do_nothing(index_elements=["id"]) (src/backend/db/operator_queue.py) and the 5s sync loop's dedup is id-only (operator_queue_item_exists(req_id), no agent scoping). Two agents choosing the same request id (e.g. the old date-serial example req-20260307-001) means the second agent's request is silently never created — never shown to an operator, never responded to, and never flipped terminal in the agent's file (write-back queries are agent-scoped), so the agent waits forever with zero log signal.
Context
Found in the #1402 review. The #1402 contract mitigates by mandating execution-id-derived request ids (approval-{execution_id}-{slug}) in the platform prompt and agent guide, but the schema-level fix is scoping uniqueness to the agent. A related lower-severity wrinkle: the lease reaper's platform-created poison-{execution_id} ids share the same global namespace, so an adversarial agent can pre-create a matching id to replace the platform's alert text with its own (_create_park_item still returns True on conflict, so the row still parks — visibility is degraded, not lost).
Acceptance Criteria
Technical Notes
src/backend/db/operator_queue.py (create/dedup), src/backend/services/operator_queue_service.py (sync), services/lease_reaper_service.py (poison-{eid} items).
- Migration reminder: schema changes touch FOUR files (schema.py, tables.py, migrations.py, Alembic revision) — see
docs/memory/learnings.md 2026-06-23.
Summary
operator_queue.idis aTEXT PRIMARY KEYshared fleet-wide; the create path useson_conflict_do_nothing(index_elements=["id"])(src/backend/db/operator_queue.py) and the 5s sync loop's dedup is id-only (operator_queue_item_exists(req_id), no agent scoping). Two agents choosing the same request id (e.g. the old date-serial examplereq-20260307-001) means the second agent's request is silently never created — never shown to an operator, never responded to, and never flipped terminal in the agent's file (write-back queries are agent-scoped), so the agent waits forever with zero log signal.Context
Found in the #1402 review. The #1402 contract mitigates by mandating execution-id-derived request ids (
approval-{execution_id}-{slug}) in the platform prompt and agent guide, but the schema-level fix is scoping uniqueness to the agent. A related lower-severity wrinkle: the lease reaper's platform-createdpoison-{execution_id}ids share the same global namespace, so an adversarial agent can pre-create a matching id to replace the platform's alert text with its own (_create_park_itemstill returns True on conflict, so the row still parks — visibility is degraded, not lost).Acceptance Criteria
(agent_name, id)(dual-track migration: SQLitedb/migrations.py+ Alembic revision +db/schema.py+db/tables.py), OR — if the PK migration is judged too disruptive — a cross-agent conflict on create is detected and logged loudly (WARN + audit) instead of silently swallowed.operator_queue_item_exists) checks the same scoped key.Technical Notes
src/backend/db/operator_queue.py(create/dedup),src/backend/services/operator_queue_service.py(sync),services/lease_reaper_service.py(poison-{eid}items).docs/memory/learnings.md2026-06-23.