Skip to content

Database Schema

Sentinel uses Cloudflare D1 (SQLite) as its system of record. The schema is defined in src/db/schema.sql.

The core table tracking every detected error.

ColumnTypeDescription
idTEXT PKULID
fingerprintTEXT NOT NULLSHA-256 error fingerprint
service_nameTEXT NOT NULLWorker service name
trigger_routeTEXTHTTP route that triggered the error
error_classTEXT NOT NULLclient_4xx, server_5xx, or unhandled_exception
error_messageTEXTFirst error message seen
statusTEXT NOT NULLCurrent lifecycle status
occurrence_countINTEGER DEFAULT 1Total times this fingerprint has been seen
first_seenTEXT NOT NULLISO 8601 timestamp
last_seenTEXT NOT NULLISO 8601 timestamp
repo_urlTEXTRepository URL for the service
commit_shaTEXTCommit SHA at time of detection
created_atTEXT DEFAULT nowRecord creation
updated_atTEXT DEFAULT nowLast update

Indexes: fingerprint, status, service_name

Audit trail for every agent execution.

ColumnTypeDescription
idTEXT PKULID
incident_idTEXT FKReferences incidents(id)
agent_typeTEXT NOT NULLlog_tailer, test_gen, triage, fix, tracing
workflow_idTEXTAssociated workflow instance ID
statusTEXT DEFAULT ‘running’running, success, failure, timeout
started_atTEXT DEFAULT nowExecution start
completed_atTEXTExecution end
duration_msINTEGERComputed duration
error_messageTEXTError details on failure
metadataTEXTJSON blob for agent-specific data

Indexes: incident_id

Cost tracking and audit for every LLM invocation.

ColumnTypeDescription
idTEXT PKULID
agent_run_idTEXT FKReferences agent_runs(id)
modelTEXT NOT NULLModel identifier
providerTEXT NOT NULLworkers_ai, anthropic, openai
prompt_tokensINTEGERInput token count
completion_tokensINTEGEROutput token count
total_tokensINTEGERTotal token count
latency_msINTEGERResponse latency
cache_hitBOOLEAN DEFAULT falseAI Gateway cache hit
input_hashTEXTHash for cache dedup

Indexes: agent_run_id

References to R2-stored binary artifacts.

ColumnTypeDescription
idTEXT PKULID
incident_idTEXT FKReferences incidents(id)
artifact_typeTEXT NOT NULLtest_case, test_result, sample_event, patch, pr_body, etc.
r2_keyTEXT NOT NULLFull R2 object key
content_typeTEXTMIME type
size_bytesINTEGERArtifact size

Indexes: incident_id

Hot-reloadable configuration for monitored services.

ColumnTypeDescription
service_nameTEXT PKWorker service name
repo_urlTEXT NOT NULLGitHub repository URL
repo_branchTEXT DEFAULT ‘main’Default branch
poll_interval_msINTEGER DEFAULT 30000Polling interval
enabledBOOLEAN DEFAULT trueWhether to monitor
error_class_filterTEXT DEFAULT ’[“server_5xx”,“unhandled_exception”]‘JSON array of error classes
min_occurrencesINTEGER DEFAULT 1Threshold before creating incident

References to GitHub issues and PRs created by Sentinel.

ColumnTypeDescription
idTEXT PKULID
incident_idTEXT FKReferences incidents(id)
artifact_typeTEXT NOT NULLissue, pr, or branch
github_repoTEXT NOT NULLowner/repo format
github_numberINTEGERIssue or PR number
github_urlTEXTFull GitHub URL

Indexes: incident_id

Phase 2 — configuration for non-Cloudflare origins monitored via Tracing Agent.

ColumnTypeDescription
origin_hostTEXT PKOrigin hostname
repo_urlTEXTRepository URL
repo_branchTEXT DEFAULT ‘main’Branch
source_languageTEXT DEFAULT ‘typescript’Language
route_mappingTEXTJSON route mapping
enabledBOOLEAN DEFAULT trueActive flag
github_token_refTEXTSecret reference for this origin’s token