Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
utopia/migrations/0035_governance_reads_the_ledger.sql at main · deeplethe/utopia · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
deeplethe
utopia
Repository navigation
Code
Issues
55
(55)
Pull requests
18
(18)
Discussions
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
utopia
/
migrations
/
0035_governance_reads_the_ledger.sql
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
40 lines (39 loc) · 2.46 KB
main
Breadcrumbs
utopia
/
migrations
/
0035_governance_reads_the_ledger.sql
Copy path
Top
File metadata and controls
Code
Blame
40 lines (39 loc) · 2.46 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--
0025:治理自己跑,先读台账再裁。
--
--
每库一个开关 governance(缺省关)。开着:抽取结束、有人裁决之后、打开开关那一刻、
--
每小时一次,排一个 govern 任务,把等人的重复对按先进先出过一遍;两簇之间看一眼
--
开关,关掉就停在那里。缺省关:合并是改图的动作,agent 的命中还没在哪个库上量过,
--
与 auto_type_resolution 缺省开的理由正相反(那一档量过 39/41,且只往子树走一格)。
--
--
agent 的每一笔是 agent_decisions 的一行:建议(proposed,等人接受或改判)、自己
--
裁了(applied,可撤)、人的回答(accepted / overridden / reverted)、被后来的人裁决
--
盖过(superseded:同名或同实体的另一对由人定了,这条建议过时,那一对回到队列)。
--
这张表就是审核台的 Agent 队列,也是接受率 / 改判率 / 撤回数的来源。
ALTER
TABLE
knowledge_bases ADD COLUMN governance
BOOLEAN
NOT NULL
DEFAULT FALSE;
CREATE
TABLE
agent_decisions
(
id UUID
PRIMARY KEY
,
kb_id UUID
NOT NULL
REFERENCES
knowledge_bases(id)
ON DELETE CASCADE
,
--
哪一轮 govern 任务:同一轮里的行是一起看的
run_id UUID
NOT NULL
,
--
现在只有 review(重复对);冲突与事实队列接进来时扩这个 CHECK
target_kind
TEXT
NOT NULL
CHECK
(target_kind
IN
(
'
review
'
)),
target_id UUID
NOT NULL
,
--
unsure 也留一行:看过了、说不准,人知道它问过
action
TEXT
NOT NULL
CHECK
(action
IN
(
'
merge
'
,
'
keep
'
,
'
unsure
'
)),
confidence
REAL
NOT NULL
DEFAULT
0
,
--
模型给的一句理由,原话
reason
TEXT
,
--
它引用的先例:[{event_id, action, left, right, at}]
precedents JSONB
NOT NULL
DEFAULT
'
[]
'
,
status
TEXT
NOT NULL
CHECK
(status
IN
(
'
proposed
'
,
'
applied
'
,
'
accepted
'
,
'
overridden
'
,
'
reverted
'
,
'
superseded
'
)),
--
applied 且是合并时:entity_merges 的那一行,撤回走它
merge_id UUID
REFERENCES
entity_merges(id)
ON DELETE
SET
NULL
,
created_at
TIMESTAMPTZ
NOT NULL
DEFAULT now(),
decided_at
TIMESTAMPTZ
,
decided_by UUID
REFERENCES
users(id)
);
CREATE
INDEX
agent_decisions_kb_idx
ON
agent_decisions (kb_id, created_at
DESC
);
--
一个目标同时只有一条开着的建议
CREATE
UNIQUE INDEX
agent_decisions_open_idx
ON
agent_decisions (target_kind, target_id)
WHERE
status
=
'
proposed
'
;
You can’t perform that action at this time.