Health checks reuse a two-second snapshot and bound the schema query. Task SSE writes an error frame when an event cannot be encoded. ResolveDocTask errors when the frozen plan has no duty row, while explicit none-duties stay zero. Drop the unwired semantic-summary replace env, record the intentional dev versus release model split, document the test/main cutover path, and archive pre-goose SQL. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
1.2 KiB
SQL
25 lines
1.2 KiB
SQL
-- chat_turns: 端到端回合幂等权威表
|
|
CREATE TABLE IF NOT EXISTS chat_turns (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
session_id TEXT NOT NULL,
|
|
client_turn_id TEXT NOT NULL,
|
|
user_id BIGINT,
|
|
project_id BIGINT,
|
|
user_message_id BIGINT REFERENCES chat_messages(id) ON DELETE SET NULL,
|
|
assistant_message_id BIGINT REFERENCES chat_messages(id) ON DELETE SET NULL,
|
|
request_body_sha256 TEXT NOT NULL DEFAULT '',
|
|
status TEXT NOT NULL DEFAULT 'accepted',
|
|
owner_token TEXT NOT NULL DEFAULT '',
|
|
lease_expires_at TIMESTAMPTZ,
|
|
first_request_id TEXT NOT NULL DEFAULT '',
|
|
last_request_id TEXT NOT NULL DEFAULT '',
|
|
attempt_count INT NOT NULL DEFAULT 1,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
completed_at TIMESTAMPTZ,
|
|
CONSTRAINT uq_chat_turns_session_client UNIQUE (session_id, client_turn_id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_chat_turns_session_status ON chat_turns(session_id, status);
|
|
CREATE INDEX IF NOT EXISTS idx_chat_turns_client ON chat_turns(client_turn_id);
|