Fail closed on unavailable Leo database truth (#119)
Some checks are pending
CI / lint-and-test (push) Waiting to run
Some checks are pending
CI / lint-and-test (push) Waiting to run
* Fail closed on unavailable Leo database truth * Cover direct DB intents in fail-closed fallback * Harden broad Leo database intent routing * Fail closed on incomplete matrix state * Distinguish unobserved matrix state
This commit is contained in:
parent
b6408cdbd1
commit
ec64dbf6d0
7 changed files with 1158 additions and 611 deletions
|
|
@ -1,23 +1,24 @@
|
|||
{
|
||||
"before_service": {
|
||||
"ActiveState": "active",
|
||||
"ExecMainStartTimestamp": "Mon 2026-07-13 11:36:05 UTC",
|
||||
"MainPID": "3874471",
|
||||
"ExecMainStartTimestamp": "Mon 2026-07-13 12:00:05 UTC",
|
||||
"MainPID": "4022106",
|
||||
"NRestarts": "0",
|
||||
"SubState": "running"
|
||||
},
|
||||
"changed_live_profile": false,
|
||||
"database_context_all_ok": true,
|
||||
"database_context_injection_count": 7,
|
||||
"database_context_injection_count": 6,
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"proposal_state_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "4ca089e04ac8270f739c130015d94128c93254f4b0fe48926161a6750526b550",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:38:31.897585+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:01:40.898914+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -26,83 +27,109 @@
|
|||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"proposal_state_readback"
|
||||
],
|
||||
"delivered_response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
|
||||
"delivered_response_sha256": "90e83aeb10bc6e856f7124651863d47e0d3b62ebd0b7339854acb36c353d72ca",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:38:49.805823+00:00",
|
||||
"issues": [],
|
||||
"generated_at_utc": "2026-07-13T12:01:56.360205+00:00",
|
||||
"issues": [
|
||||
"missing_live_count_readback:proposal_state_readback",
|
||||
"missing_live_proposal_state:applied",
|
||||
"missing_live_proposal_state:approved",
|
||||
"missing_live_proposal_state:canceled",
|
||||
"missing_live_proposal_state:pending_review",
|
||||
"missing_proof_changing_followup",
|
||||
"missing_proposal_apply_boundary"
|
||||
],
|
||||
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
|
||||
"response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
|
||||
"response_sha256": "2f6e02e23d2fde91444815f4ca0cbe971e809789a78c39975dd4a3cbbe82a16f",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:38:50.066196+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
|
||||
"source": "kb_tool.py --local context",
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
],
|
||||
"delivered_response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:07.285878+00:00",
|
||||
"issues": [],
|
||||
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
|
||||
"response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:07.468758+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
|
||||
"source": "kb_tool.py --local context",
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
],
|
||||
"delivered_response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:16.780703+00:00",
|
||||
"issues": [],
|
||||
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
|
||||
"response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget",
|
||||
"source_intake"
|
||||
"named_packet_readback"
|
||||
],
|
||||
"contract_sha256": "aa7ea45feb00cf01f5e070f4e46dacdd375168a5321b8b8710473161a6e98ec4",
|
||||
"contract_sha256": "17008e0a4373710ea886cfe3b6c12aa4de82801041207fb139be388625ff39c9",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:17.639400+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:01:56.557824+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
|
||||
"source": "kb_tool.py --local context",
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget",
|
||||
"named_packet_readback"
|
||||
],
|
||||
"delivered_response_sha256": "883bdeb5bb12d3ef600ce8c0d3e9c0eb9d7e806fd8c7c35a90028058bf61a9d0",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T12:02:01.637126+00:00",
|
||||
"issues": [
|
||||
"missing_named_packet_term:applied_at",
|
||||
"missing_named_packet_term:authorization",
|
||||
"missing_named_packet_term:helmer",
|
||||
"missing_named_packet_term:kb_stage",
|
||||
"missing_named_packet_term:postflight",
|
||||
"missing_named_proposal_readback",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
|
||||
"response_sha256": "b4fe89c28a93e532df616e2b33a20a57f7b86e81a2b873a3988d3f11bcfa4696",
|
||||
"status": "ok",
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget",
|
||||
"decision_matrix_readback"
|
||||
],
|
||||
"contract_sha256": "5c0a1690050fdc1351d4edb00e0f6ceeef590795046c588fb98565a356d739d5",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T12:02:06.739369+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
|
||||
"source": "kb_tool.py --local context",
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget",
|
||||
"decision_matrix_readback"
|
||||
],
|
||||
"delivered_response_sha256": "0d90caf99aa5630a79a1e6e92f5b4f99e13c19e6c0d5282f8850c49b3612a006",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T12:02:13.019793+00:00",
|
||||
"issues": [
|
||||
"missing_live_count_readback:decision_matrix_readback",
|
||||
"missing_live_matrix_table_readback",
|
||||
"missing_matrix_approval_boundary",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
|
||||
"response_sha256": "73a1c6233b17e34d185fde7881bccf1766980ac2f97a263c904ff83099cd6137",
|
||||
"status": "ok",
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget",
|
||||
"source_link_audit"
|
||||
],
|
||||
"contract_sha256": "8d863639a7a4dac37aeceb993d70949ec0b7bafae0bb88588ad558105ee0592d",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T12:02:17.041295+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -112,84 +139,72 @@
|
|||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget",
|
||||
"source_intake"
|
||||
"source_link_audit"
|
||||
],
|
||||
"delivered_response_sha256": "3ec2e7f161a6584416893483bde07e72d6bcf4ca90714964ea513b8f9c217cfb",
|
||||
"delivered_response_sha256": "4f1a1b5b097054ca8aa7bd8b084aa5b7087f121b45eb497e25cbbd32e4c8c478",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:39.494599+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:27.480654+00:00",
|
||||
"issues": [
|
||||
"missing_apply_boundary"
|
||||
"missing_live_count_readback:source_link_audit",
|
||||
"missing_live_source_link_audit",
|
||||
"missing_proof_changing_followup",
|
||||
"missing_source_link_causality_boundary",
|
||||
"missing_source_link_layer:document_evaluations",
|
||||
"missing_source_link_layer:telegram_file_refs"
|
||||
],
|
||||
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
|
||||
"response_sha256": "612baabbaa3c034aeb772adcce757b46f36228fce393d9b16ec4737ba9b6a69d",
|
||||
"response_sha256": "50c759d09316dbb2398de4914f563a63da3b2949cce489ebb88f92f004d04e5b",
|
||||
"status": "ok",
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"demo_capability_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "e295fe1b0e86a0e1fb105d68419c347f546693915536ca9bf1867f7b554f90da",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:39.809593+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:27.656154+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
|
||||
"source": "kb_tool.py --local context",
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:39.830446+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
|
||||
"source": "kb_tool.py --local context",
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"demo_capability_readback"
|
||||
],
|
||||
"delivered_response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
|
||||
"delivered_response_sha256": "e7754500bbeb518c6e594c5b80f007792feeaf1f3972b70216ade71baa63257a",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:42.899946+00:00",
|
||||
"issues": [],
|
||||
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
|
||||
"response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"generated_at_utc": "2026-07-13T12:02:40.897189+00:00",
|
||||
"issues": [
|
||||
"missing_demo_claim_ceiling",
|
||||
"missing_demo_state:applied",
|
||||
"missing_demo_state:approved",
|
||||
"missing_demo_state:pending_review",
|
||||
"missing_demo_term:artifact",
|
||||
"missing_live_count_readback:demo_capability_readback",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"delivered_response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:53.275938+00:00",
|
||||
"issues": [],
|
||||
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
|
||||
"response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
|
||||
"response_sha256": "90a55750d86902598b8baddc1160cb61e4e69e83c54480180c8c9c736418a14d",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"identity_canonicality_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "e35fe90e372b039e05a385edc11a632b3025c40179ed750eda27ed1e360970e7",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:53.448528+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:41.073797+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -198,22 +213,28 @@
|
|||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"identity_canonicality_readback"
|
||||
],
|
||||
"delivered_response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
|
||||
"delivered_response_sha256": "8350f81c2d3561793e4256c7e2514fce4fd7155e0d32d728cf72474bdf060e5e",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:40:03.097532+00:00",
|
||||
"issues": [],
|
||||
"generated_at_utc": "2026-07-13T12:02:47.356639+00:00",
|
||||
"issues": [
|
||||
"missing_identity_canonicality_boundary",
|
||||
"missing_identity_term:canonical postgres rows",
|
||||
"missing_live_count_readback:identity_canonicality_readback",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
|
||||
"response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
|
||||
"response_sha256": "9a9d1f53298b286e547a5e1133edfa8aa95c242dcdb88ca2e9430b541d844cff",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"database_response_transform_count": 1,
|
||||
"database_response_transform_count": 6,
|
||||
"database_response_validation_all_ok": true,
|
||||
"database_response_validation_count": 7,
|
||||
"database_response_validation_count": 6,
|
||||
"db_counts_after": {
|
||||
"kb_stage.kb_proposals": 26,
|
||||
"public.claim_edges": 4916,
|
||||
|
|
@ -229,11 +250,11 @@
|
|||
"public.sources": 4145
|
||||
},
|
||||
"db_counts_changed": false,
|
||||
"generated_at_utc": "2026-07-13T11:38:28.880456+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:01:37.716139+00:00",
|
||||
"handler": {
|
||||
"authorized": true,
|
||||
"session_key": "agent:main:telegram:group:-5146042086:9070919",
|
||||
"temp_profile": "/tmp/leo-direct-claim-handler-s3_x4vv7/profile"
|
||||
"temp_profile": "/tmp/leo-direct-claim-handler-zm2yncnp/profile"
|
||||
},
|
||||
"harness_notes": [
|
||||
"Prompts are the exact DC-01..DC-06 direct-claim benchmark messages.",
|
||||
|
|
@ -244,21 +265,22 @@
|
|||
"mutates_kb_by_harness": false,
|
||||
"pass_runtime": true,
|
||||
"posted_to_telegram": false,
|
||||
"remote_report_path": "/tmp/leo-direct-claim-handler-report-a3ae5a381733.json",
|
||||
"remote_report_path": "/tmp/leo-direct-claim-handler-report-e8eba83f7fd4.json",
|
||||
"remote_returncode": 0,
|
||||
"remote_run_id": "a3ae5a381733",
|
||||
"remote_run_id": "e8eba83f7fd4",
|
||||
"results": [
|
||||
{
|
||||
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"proposal_state_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "4ca089e04ac8270f739c130015d94128c93254f4b0fe48926161a6750526b550",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:38:31.897585+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:01:40.898914+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -267,41 +289,51 @@
|
|||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"proposal_state_readback"
|
||||
],
|
||||
"delivered_response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
|
||||
"delivered_response_sha256": "90e83aeb10bc6e856f7124651863d47e0d3b62ebd0b7339854acb36c353d72ca",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:38:49.805823+00:00",
|
||||
"issues": [],
|
||||
"generated_at_utc": "2026-07-13T12:01:56.360205+00:00",
|
||||
"issues": [
|
||||
"missing_live_count_readback:proposal_state_readback",
|
||||
"missing_live_proposal_state:applied",
|
||||
"missing_live_proposal_state:approved",
|
||||
"missing_live_proposal_state:canceled",
|
||||
"missing_live_proposal_state:pending_review",
|
||||
"missing_proof_changing_followup",
|
||||
"missing_proposal_apply_boundary"
|
||||
],
|
||||
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
|
||||
"response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
|
||||
"response_sha256": "2f6e02e23d2fde91444815f4ca0cbe971e809789a78c39975dd4a3cbbe82a16f",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "db_changed_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:38:49.920497+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:01:56.465323+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "Did we actually update the knowledge base, or is it still just proposals?",
|
||||
"prompt_id": "DC-01",
|
||||
"reply": "Mixed \u2014 both are true.\n\n- 2 proposals have applied_at set and are canonical DB writes. Those changes are in the KB.\n- 3 proposals are approved but not applied \u2014 intent approval only, no canonical mutation yet. The apply worker must run strict payload through the guarded path before those land.\n- 14 more are still pending_review \u2014 proposals only.\n\nNext action: if you want to know which specific approved proposals are waiting, run `teleo-kb list-proposals --status approved` and I'll read the readiness state on each to confirm whether they're apply-ready or need payload normalization first.",
|
||||
"started_at_utc": "2026-07-13T11:38:29.316462+00:00",
|
||||
"reply": "Partly.\nDB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\nProposal states are applied: 2, approved: 3, pending_review: 14, canceled: 7. Approved is not applied, and an applied proposal receipt alone does not identify the exact public.* rows changed.\n\nNext proof-changing follow-up: choose the proposal or time window, return its UUID/status/applied_at, compare the affected public.* row IDs or before/after hashes, and for approved rows normalize and review the strict payload before requesting explicit guarded-apply authorization.",
|
||||
"started_at_utc": "2026-07-13T12:01:38.185363+00:00",
|
||||
"turn": 1
|
||||
},
|
||||
{
|
||||
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"named_packet_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "17008e0a4373710ea886cfe3b6c12aa4de82801041207fb139be388625ff39c9",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:38:50.066196+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:01:56.557824+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -310,41 +342,51 @@
|
|||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"named_packet_readback"
|
||||
],
|
||||
"delivered_response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
|
||||
"delivered_response_sha256": "883bdeb5bb12d3ef600ce8c0d3e9c0eb9d7e806fd8c7c35a90028058bf61a9d0",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:07.285878+00:00",
|
||||
"issues": [],
|
||||
"generated_at_utc": "2026-07-13T12:02:01.637126+00:00",
|
||||
"issues": [
|
||||
"missing_named_packet_term:applied_at",
|
||||
"missing_named_packet_term:authorization",
|
||||
"missing_named_packet_term:helmer",
|
||||
"missing_named_packet_term:kb_stage",
|
||||
"missing_named_packet_term:postflight",
|
||||
"missing_named_proposal_readback",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
|
||||
"response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
|
||||
"response_sha256": "b4fe89c28a93e532df616e2b33a20a57f7b86e81a2b873a3988d3f11bcfa4696",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "helmer_live_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:39:07.332593+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:02:06.581499+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "Is Helmer's 7 Powers in Leo now?",
|
||||
"prompt_id": "DC-02",
|
||||
"reply": "Not in the KB yet. Still proposals only.\n\n- One proposal (a64df080) is approved but has applied_at: null and readiness: approved_needs_apply_payload. No strict payload exists, so the apply worker can't run it.\n- The earlier proposal (cea989fc) was canceled; that's the one that had the self-positioning claim bundled in.\n\nBlocking step: that approved proposal needs a normalized strict apply payload before it can land as a canonical reasoning_tool + source + evidence rows. Want me to build that payload now?",
|
||||
"started_at_utc": "2026-07-13T11:38:49.921146+00:00",
|
||||
"reply": "No, Helmer's 7 Powers is not in canonical Leo yet.\nDB readback: proposal: a64df080-8502-42e2-98f4-9bbdecb8da73; status: approved; applied_at: none; readiness: approved_needs_apply_payload.\nThe packet is present in kb_stage and may be reviewer-approved, but applied_at is empty and its readiness still requires a strict apply payload; that is not a write to public.reasoning_tools, claims, sources, or claim_evidence. The packet is not applied.\n\nNext proof-changing follow-up: show the normalized packet, renew review, obtain explicit apply authorization, run the guarded apply in dependency order, then return proposal applied_at, created row IDs, public.* postflight, and the Telegram regression receipt.",
|
||||
"started_at_utc": "2026-07-13T12:01:56.466499+00:00",
|
||||
"turn": 2
|
||||
},
|
||||
{
|
||||
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"decision_matrix_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "5c0a1690050fdc1351d4edb00e0f6ceeef590795046c588fb98565a356d739d5",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:07.468758+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:06.739369+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -353,28 +395,34 @@
|
|||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"decision_matrix_readback"
|
||||
],
|
||||
"delivered_response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
|
||||
"delivered_response_sha256": "0d90caf99aa5630a79a1e6e92f5b4f99e13c19e6c0d5282f8850c49b3612a006",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:16.780703+00:00",
|
||||
"issues": [],
|
||||
"generated_at_utc": "2026-07-13T12:02:13.019793+00:00",
|
||||
"issues": [
|
||||
"missing_live_count_readback:decision_matrix_readback",
|
||||
"missing_live_matrix_table_readback",
|
||||
"missing_matrix_approval_boundary",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
|
||||
"response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
|
||||
"response_sha256": "73a1c6233b17e34d185fde7881bccf1766980ac2f97a263c904ff83099cd6137",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "decision_matrix_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:39:17.492476+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:02:16.771963+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "Did the decision matrix approve this already?",
|
||||
"prompt_id": "DC-03",
|
||||
"reply": "No. Decision-matrix tables don't exist in the DB at all \u2014 no proposal_votes, proposal_decisions, or matrix_voters in any schema.\n\n- The approved status on a64df080 is a human reviewer approval (you, via Telegram), not a futarchy/decision-matrix vote.\n- No matrix vote has ever run on any proposal; the schema hasn't been built yet.\n\nSo the Helmer proposal has human approval-with-changes, but not decision-matrix approval \u2014 those are different gates.",
|
||||
"started_at_utc": "2026-07-13T11:39:07.333137+00:00",
|
||||
"reply": "No.\nDB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\nFresh readback: 6 matrix tables are absent (kb_stage.matrix_voters, kb_stage.proposal_decisions, kb_stage.proposal_votes, public.matrix_voters, public.proposal_decisions, public.proposal_votes). kb_stage reviewer status is not a decision-matrix vote, so no proposal can be called matrix-approved from proposal status alone.\n\nNext proof-changing follow-up: inspect the specific proposal UUID/status/applied_at in kb_stage, then either show proposal_votes plus proposal_decisions for that UUID after the schema exists, or use the human review and guarded canonical apply path with row-level postflight.",
|
||||
"started_at_utc": "2026-07-13T12:02:06.582055+00:00",
|
||||
"turn": 3
|
||||
},
|
||||
{
|
||||
|
|
@ -384,11 +432,11 @@
|
|||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget",
|
||||
"source_intake"
|
||||
"source_link_audit"
|
||||
],
|
||||
"contract_sha256": "aa7ea45feb00cf01f5e070f4e46dacdd375168a5321b8b8710473161a6e98ec4",
|
||||
"contract_sha256": "8d863639a7a4dac37aeceb993d70949ec0b7bafae0bb88588ad558105ee0592d",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:17.639400+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:17.041295+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -398,114 +446,102 @@
|
|||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget",
|
||||
"source_intake"
|
||||
"source_link_audit"
|
||||
],
|
||||
"delivered_response_sha256": "3ec2e7f161a6584416893483bde07e72d6bcf4ca90714964ea513b8f9c217cfb",
|
||||
"delivered_response_sha256": "4f1a1b5b097054ca8aa7bd8b084aa5b7087f121b45eb497e25cbbd32e4c8c478",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:39.494599+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:27.480654+00:00",
|
||||
"issues": [
|
||||
"missing_apply_boundary"
|
||||
"missing_live_count_readback:source_link_audit",
|
||||
"missing_live_source_link_audit",
|
||||
"missing_proof_changing_followup",
|
||||
"missing_source_link_causality_boundary",
|
||||
"missing_source_link_layer:document_evaluations",
|
||||
"missing_source_link_layer:telegram_file_refs"
|
||||
],
|
||||
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
|
||||
"response_sha256": "612baabbaa3c034aeb772adcce757b46f36228fce393d9b16ec4737ba9b6a69d",
|
||||
"response_sha256": "50c759d09316dbb2398de4914f563a63da3b2949cce489ebb88f92f004d04e5b",
|
||||
"status": "ok",
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "document_source_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:39:39.550884+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:02:27.513351+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "Are the pending proposals stuck because the documents are not pointed at the right source rows?",
|
||||
"prompt_id": "DC-04",
|
||||
"reply": "- Local compiler proven; live VPS/chat intake not shipped. Immediately retain artifact plus URL or storage_path plus content hash. A filename, chat label, attachment reference, or source_ref is not source identity.\n\n- extract candidates into a pending_review proposal packet. Deduplicate candidate claims and retain evidence excerpts and contradictions. Do not create public.sources or other canonical rows during capture or staging.\n\n- Explicit approval begins before guarded canonical public.* apply, not before mechanical capture/staging. The receipt should include the retained locator and hash, proposal ID and status, reviewed payload, proposal-level applied_at, created row IDs, and postflight readback. Until apply succeeds, the material is staged rather than live canonical knowledge.",
|
||||
"started_at_utc": "2026-07-13T11:39:17.493177+00:00",
|
||||
"reply": "Not proven.\nDB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\nThe live row-link audit found 17 pending/approved proposals: 17 have source_ref and 0 exactly match a public.sources ID, URL, or storage_path. Pending status therefore is not by itself proof of a bad document pointer.\n\nAudit telegram_file_refs/raw files -> document_evaluations -> kb_proposals.source_ref -> public.sources -> claim_evidence. Next proof-changing follow-up: list each proposal UUID/status/source_ref and exact source match, then stage only the missing guarded source/evidence apply contract.",
|
||||
"started_at_utc": "2026-07-13T12:02:16.772613+00:00",
|
||||
"turn": 4
|
||||
},
|
||||
{
|
||||
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"demo_capability_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "e295fe1b0e86a0e1fb105d68419c347f546693915536ca9bf1867f7b554f90da",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:39.809593+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:27.656154+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
|
||||
"source": "kb_tool.py --local context",
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:39.830446+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
|
||||
"source": "kb_tool.py --local context",
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"demo_capability_readback"
|
||||
],
|
||||
"delivered_response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
|
||||
"delivered_response_sha256": "e7754500bbeb518c6e594c5b80f007792feeaf1f3972b70216ade71baa63257a",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:42.899946+00:00",
|
||||
"issues": [],
|
||||
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
|
||||
"response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"generated_at_utc": "2026-07-13T12:02:40.897189+00:00",
|
||||
"issues": [
|
||||
"missing_demo_claim_ceiling",
|
||||
"missing_demo_state:applied",
|
||||
"missing_demo_state:approved",
|
||||
"missing_demo_state:pending_review",
|
||||
"missing_demo_term:artifact",
|
||||
"missing_live_count_readback:demo_capability_readback",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"delivered_response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:53.275938+00:00",
|
||||
"issues": [],
|
||||
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
|
||||
"response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
|
||||
"response_sha256": "90a55750d86902598b8baddc1160cb61e4e69e83c54480180c8c9c736418a14d",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "demo_changes_kb_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:39:53.305948+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:02:40.932754+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "Can I demo that Leo changes the KB?",
|
||||
"prompt_id": "DC-05",
|
||||
"reply": "Yes, partially \u2014 two distinct things to show:\n\n- What's proven end-to-end: Leo writes a proposal to kb_stage via Telegram (canary add_edge proposals prove this path). Proposal appears in the ledger with a UUID and readiness state. That's a demonstrated DB write, just not to public.*.\n- What's live-proven for canonical mutation: the strict existing-ID add_edge path. Proposal 8dfedb3f already has has_apply_payload: True. If you authorize it, that edge can apply to public.claim_edges and we'd get a non-null applied_at plus a new row ID as receipt.\n- What's not yet demo-ready: approve_claim bundles (reasoning_tools, sources, claims) \u2014 that path is clone-proven, not production-proven. The Helmer proposal is blocked here.\n\nCleanest demo right now: authorize 8dfedb3f and watch the edge land in public.claim_edges with postflight row readback. Want to run that?",
|
||||
"started_at_utc": "2026-07-13T11:39:39.552016+00:00",
|
||||
"reply": "Partly.\nDB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\nProposal states are applied: 2, approved: 3, pending_review: 14. Existing receipts show applied proposal types: add_edge and attach_evidence; that receipt artifact does not prove every rich packet or chat apply path is live. You can safely demo canonical readback and a pending_review staging write. A new canonical apply requires explicit authorization, a supported strict payload, and postflight row IDs.\n\nNext proof-changing follow-up: choose the demo tier - existing applied receipt, safe staging canary, or an explicitly authorized guarded apply - then capture proposal UUID/status/applied_at, public.* before/after, and Telegram-visible regression proof.",
|
||||
"started_at_utc": "2026-07-13T12:02:27.514232+00:00",
|
||||
"turn": 5
|
||||
},
|
||||
{
|
||||
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"identity_canonicality_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "e35fe90e372b039e05a385edc11a632b3025c40179ed750eda27ed1e360970e7",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:53.448528+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:41.073797+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -514,43 +550,49 @@
|
|||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"identity_canonicality_readback"
|
||||
],
|
||||
"delivered_response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
|
||||
"delivered_response_sha256": "8350f81c2d3561793e4256c7e2514fce4fd7155e0d32d728cf72474bdf060e5e",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:40:03.097532+00:00",
|
||||
"issues": [],
|
||||
"generated_at_utc": "2026-07-13T12:02:47.356639+00:00",
|
||||
"issues": [
|
||||
"missing_identity_canonicality_boundary",
|
||||
"missing_identity_term:canonical postgres rows",
|
||||
"missing_live_count_readback:identity_canonicality_readback",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
|
||||
"response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
|
||||
"response_sha256": "9a9d1f53298b286e547a5e1133edfa8aa95c242dcdb88ca2e9430b541d844cff",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "soul_identity_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:40:03.458478+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:02:51.086958+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "If we changed SOUL.md, did we change Leo's canonical identity?",
|
||||
"prompt_id": "DC-06",
|
||||
"reply": "No.\n\n- SOUL.md is a render from the Postgres DB, not the source. Editing the file changes what gets injected at runtime but leaves the canonical rows (personas, beliefs, strategies, strategy nodes) untouched. The DB is the identity; SOUL.md is a snapshot of it.\n- Canonical identity changes require a reviewed proposal applied through the guarded path with non-null applied_at and postflight row readback. No active general DB-to-SOUL.md renderer automation is currently proven, so the render and the DB can drift.\n- A SOUL.md edit without a matching DB write is a runtime override, not a canonical change \u2014 and it gets wiped the next time the renderer runs.",
|
||||
"started_at_utc": "2026-07-13T11:39:53.306844+00:00",
|
||||
"reply": "No.\nDB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\nA direct SOUL.md edit is a runtime/profile change; it does not change canonical Postgres rows in personas, strategies, beliefs, strategy_nodes, or strategy_node_anchors. No active general DB-to-SOUL.md renderer automation is currently proven, so neither a future render nor persistence of the edit should be assumed.\n\nNext proof-changing follow-up: audit the intended canonical identity rows and proposal UUID/status/applied_at, stage or apply the reviewed DB change with authorization, run or verify render/sync, then compare SOUL.md hash/content and restart readback.",
|
||||
"started_at_utc": "2026-07-13T12:02:40.933500+00:00",
|
||||
"turn": 6
|
||||
}
|
||||
],
|
||||
"service_before_after": {
|
||||
"after": {
|
||||
"ActiveState": "active",
|
||||
"ExecMainStartTimestamp": "Mon 2026-07-13 11:36:05 UTC",
|
||||
"MainPID": "3874471",
|
||||
"ExecMainStartTimestamp": "Mon 2026-07-13 12:00:05 UTC",
|
||||
"MainPID": "4022106",
|
||||
"NRestarts": "0",
|
||||
"SubState": "running"
|
||||
},
|
||||
"before": {
|
||||
"ActiveState": "active",
|
||||
"ExecMainStartTimestamp": "Mon 2026-07-13 11:36:05 UTC",
|
||||
"MainPID": "3874471",
|
||||
"ExecMainStartTimestamp": "Mon 2026-07-13 12:00:05 UTC",
|
||||
"MainPID": "4022106",
|
||||
"NRestarts": "0",
|
||||
"SubState": "running"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
"runtime": "disposable_clone_or_sandbox_first"
|
||||
}
|
||||
],
|
||||
"generated_at_utc": "2026-07-13T11:40:14.948113+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:03:35.440735+00:00",
|
||||
"include_direct_claim_followups": true,
|
||||
"include_m3taversal_outcomes": false,
|
||||
"mode": "retained_evidence_score",
|
||||
|
|
@ -32,13 +32,14 @@
|
|||
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"proposal_state_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "4ca089e04ac8270f739c130015d94128c93254f4b0fe48926161a6750526b550",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:38:31.897585+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:01:40.898914+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -47,41 +48,51 @@
|
|||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"proposal_state_readback"
|
||||
],
|
||||
"delivered_response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
|
||||
"delivered_response_sha256": "90e83aeb10bc6e856f7124651863d47e0d3b62ebd0b7339854acb36c353d72ca",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:38:49.805823+00:00",
|
||||
"issues": [],
|
||||
"generated_at_utc": "2026-07-13T12:01:56.360205+00:00",
|
||||
"issues": [
|
||||
"missing_live_count_readback:proposal_state_readback",
|
||||
"missing_live_proposal_state:applied",
|
||||
"missing_live_proposal_state:approved",
|
||||
"missing_live_proposal_state:canceled",
|
||||
"missing_live_proposal_state:pending_review",
|
||||
"missing_proof_changing_followup",
|
||||
"missing_proposal_apply_boundary"
|
||||
],
|
||||
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
|
||||
"response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
|
||||
"response_sha256": "2f6e02e23d2fde91444815f4ca0cbe971e809789a78c39975dd4a3cbbe82a16f",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "db_changed_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:38:49.920497+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:01:56.465323+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "Did we actually update the knowledge base, or is it still just proposals?",
|
||||
"prompt_id": "DC-01",
|
||||
"reply": "Mixed \u2014 both are true.\n\n- 2 proposals have applied_at set and are canonical DB writes. Those changes are in the KB.\n- 3 proposals are approved but not applied \u2014 intent approval only, no canonical mutation yet. The apply worker must run strict payload through the guarded path before those land.\n- 14 more are still pending_review \u2014 proposals only.\n\nNext action: if you want to know which specific approved proposals are waiting, run `teleo-kb list-proposals --status approved` and I'll read the readiness state on each to confirm whether they're apply-ready or need payload normalization first.",
|
||||
"started_at_utc": "2026-07-13T11:38:29.316462+00:00",
|
||||
"reply": "Partly.\nDB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\nProposal states are applied: 2, approved: 3, pending_review: 14, canceled: 7. Approved is not applied, and an applied proposal receipt alone does not identify the exact public.* rows changed.\n\nNext proof-changing follow-up: choose the proposal or time window, return its UUID/status/applied_at, compare the affected public.* row IDs or before/after hashes, and for approved rows normalize and review the strict payload before requesting explicit guarded-apply authorization.",
|
||||
"started_at_utc": "2026-07-13T12:01:38.185363+00:00",
|
||||
"turn": 1
|
||||
},
|
||||
{
|
||||
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"named_packet_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "17008e0a4373710ea886cfe3b6c12aa4de82801041207fb139be388625ff39c9",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:38:50.066196+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:01:56.557824+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -90,41 +101,51 @@
|
|||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"named_packet_readback"
|
||||
],
|
||||
"delivered_response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
|
||||
"delivered_response_sha256": "883bdeb5bb12d3ef600ce8c0d3e9c0eb9d7e806fd8c7c35a90028058bf61a9d0",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:07.285878+00:00",
|
||||
"issues": [],
|
||||
"generated_at_utc": "2026-07-13T12:02:01.637126+00:00",
|
||||
"issues": [
|
||||
"missing_named_packet_term:applied_at",
|
||||
"missing_named_packet_term:authorization",
|
||||
"missing_named_packet_term:helmer",
|
||||
"missing_named_packet_term:kb_stage",
|
||||
"missing_named_packet_term:postflight",
|
||||
"missing_named_proposal_readback",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
|
||||
"response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
|
||||
"response_sha256": "b4fe89c28a93e532df616e2b33a20a57f7b86e81a2b873a3988d3f11bcfa4696",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "helmer_live_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:39:07.332593+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:02:06.581499+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "Is Helmer's 7 Powers in Leo now?",
|
||||
"prompt_id": "DC-02",
|
||||
"reply": "Not in the KB yet. Still proposals only.\n\n- One proposal (a64df080) is approved but has applied_at: null and readiness: approved_needs_apply_payload. No strict payload exists, so the apply worker can't run it.\n- The earlier proposal (cea989fc) was canceled; that's the one that had the self-positioning claim bundled in.\n\nBlocking step: that approved proposal needs a normalized strict apply payload before it can land as a canonical reasoning_tool + source + evidence rows. Want me to build that payload now?",
|
||||
"started_at_utc": "2026-07-13T11:38:49.921146+00:00",
|
||||
"reply": "No, Helmer's 7 Powers is not in canonical Leo yet.\nDB readback: proposal: a64df080-8502-42e2-98f4-9bbdecb8da73; status: approved; applied_at: none; readiness: approved_needs_apply_payload.\nThe packet is present in kb_stage and may be reviewer-approved, but applied_at is empty and its readiness still requires a strict apply payload; that is not a write to public.reasoning_tools, claims, sources, or claim_evidence. The packet is not applied.\n\nNext proof-changing follow-up: show the normalized packet, renew review, obtain explicit apply authorization, run the guarded apply in dependency order, then return proposal applied_at, created row IDs, public.* postflight, and the Telegram regression receipt.",
|
||||
"started_at_utc": "2026-07-13T12:01:56.466499+00:00",
|
||||
"turn": 2
|
||||
},
|
||||
{
|
||||
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"decision_matrix_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "5c0a1690050fdc1351d4edb00e0f6ceeef590795046c588fb98565a356d739d5",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:07.468758+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:06.739369+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -133,28 +154,34 @@
|
|||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"decision_matrix_readback"
|
||||
],
|
||||
"delivered_response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
|
||||
"delivered_response_sha256": "0d90caf99aa5630a79a1e6e92f5b4f99e13c19e6c0d5282f8850c49b3612a006",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:16.780703+00:00",
|
||||
"issues": [],
|
||||
"generated_at_utc": "2026-07-13T12:02:13.019793+00:00",
|
||||
"issues": [
|
||||
"missing_live_count_readback:decision_matrix_readback",
|
||||
"missing_live_matrix_table_readback",
|
||||
"missing_matrix_approval_boundary",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
|
||||
"response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
|
||||
"response_sha256": "73a1c6233b17e34d185fde7881bccf1766980ac2f97a263c904ff83099cd6137",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "decision_matrix_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:39:17.492476+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:02:16.771963+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "Did the decision matrix approve this already?",
|
||||
"prompt_id": "DC-03",
|
||||
"reply": "No. Decision-matrix tables don't exist in the DB at all \u2014 no proposal_votes, proposal_decisions, or matrix_voters in any schema.\n\n- The approved status on a64df080 is a human reviewer approval (you, via Telegram), not a futarchy/decision-matrix vote.\n- No matrix vote has ever run on any proposal; the schema hasn't been built yet.\n\nSo the Helmer proposal has human approval-with-changes, but not decision-matrix approval \u2014 those are different gates.",
|
||||
"started_at_utc": "2026-07-13T11:39:07.333137+00:00",
|
||||
"reply": "No.\nDB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\nFresh readback: 6 matrix tables are absent (kb_stage.matrix_voters, kb_stage.proposal_decisions, kb_stage.proposal_votes, public.matrix_voters, public.proposal_decisions, public.proposal_votes). kb_stage reviewer status is not a decision-matrix vote, so no proposal can be called matrix-approved from proposal status alone.\n\nNext proof-changing follow-up: inspect the specific proposal UUID/status/applied_at in kb_stage, then either show proposal_votes plus proposal_decisions for that UUID after the schema exists, or use the human review and guarded canonical apply path with row-level postflight.",
|
||||
"started_at_utc": "2026-07-13T12:02:06.582055+00:00",
|
||||
"turn": 3
|
||||
},
|
||||
{
|
||||
|
|
@ -164,11 +191,11 @@
|
|||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget",
|
||||
"source_intake"
|
||||
"source_link_audit"
|
||||
],
|
||||
"contract_sha256": "aa7ea45feb00cf01f5e070f4e46dacdd375168a5321b8b8710473161a6e98ec4",
|
||||
"contract_sha256": "8d863639a7a4dac37aeceb993d70949ec0b7bafae0bb88588ad558105ee0592d",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:17.639400+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:17.041295+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -178,114 +205,102 @@
|
|||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget",
|
||||
"source_intake"
|
||||
"source_link_audit"
|
||||
],
|
||||
"delivered_response_sha256": "3ec2e7f161a6584416893483bde07e72d6bcf4ca90714964ea513b8f9c217cfb",
|
||||
"delivered_response_sha256": "4f1a1b5b097054ca8aa7bd8b084aa5b7087f121b45eb497e25cbbd32e4c8c478",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:39.494599+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:27.480654+00:00",
|
||||
"issues": [
|
||||
"missing_apply_boundary"
|
||||
"missing_live_count_readback:source_link_audit",
|
||||
"missing_live_source_link_audit",
|
||||
"missing_proof_changing_followup",
|
||||
"missing_source_link_causality_boundary",
|
||||
"missing_source_link_layer:document_evaluations",
|
||||
"missing_source_link_layer:telegram_file_refs"
|
||||
],
|
||||
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
|
||||
"response_sha256": "612baabbaa3c034aeb772adcce757b46f36228fce393d9b16ec4737ba9b6a69d",
|
||||
"response_sha256": "50c759d09316dbb2398de4914f563a63da3b2949cce489ebb88f92f004d04e5b",
|
||||
"status": "ok",
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "document_source_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:39:39.550884+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:02:27.513351+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "Are the pending proposals stuck because the documents are not pointed at the right source rows?",
|
||||
"prompt_id": "DC-04",
|
||||
"reply": "- Local compiler proven; live VPS/chat intake not shipped. Immediately retain artifact plus URL or storage_path plus content hash. A filename, chat label, attachment reference, or source_ref is not source identity.\n\n- extract candidates into a pending_review proposal packet. Deduplicate candidate claims and retain evidence excerpts and contradictions. Do not create public.sources or other canonical rows during capture or staging.\n\n- Explicit approval begins before guarded canonical public.* apply, not before mechanical capture/staging. The receipt should include the retained locator and hash, proposal ID and status, reviewed payload, proposal-level applied_at, created row IDs, and postflight readback. Until apply succeeds, the material is staged rather than live canonical knowledge.",
|
||||
"started_at_utc": "2026-07-13T11:39:17.493177+00:00",
|
||||
"reply": "Not proven.\nDB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\nThe live row-link audit found 17 pending/approved proposals: 17 have source_ref and 0 exactly match a public.sources ID, URL, or storage_path. Pending status therefore is not by itself proof of a bad document pointer.\n\nAudit telegram_file_refs/raw files -> document_evaluations -> kb_proposals.source_ref -> public.sources -> claim_evidence. Next proof-changing follow-up: list each proposal UUID/status/source_ref and exact source match, then stage only the missing guarded source/evidence apply contract.",
|
||||
"started_at_utc": "2026-07-13T12:02:16.772613+00:00",
|
||||
"turn": 4
|
||||
},
|
||||
{
|
||||
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"demo_capability_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "e295fe1b0e86a0e1fb105d68419c347f546693915536ca9bf1867f7b554f90da",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:39.809593+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:27.656154+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
|
||||
"source": "kb_tool.py --local context",
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:39.830446+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
|
||||
"source": "kb_tool.py --local context",
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"demo_capability_readback"
|
||||
],
|
||||
"delivered_response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
|
||||
"delivered_response_sha256": "e7754500bbeb518c6e594c5b80f007792feeaf1f3972b70216ade71baa63257a",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:42.899946+00:00",
|
||||
"issues": [],
|
||||
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
|
||||
"response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"generated_at_utc": "2026-07-13T12:02:40.897189+00:00",
|
||||
"issues": [
|
||||
"missing_demo_claim_ceiling",
|
||||
"missing_demo_state:applied",
|
||||
"missing_demo_state:approved",
|
||||
"missing_demo_state:pending_review",
|
||||
"missing_demo_term:artifact",
|
||||
"missing_live_count_readback:demo_capability_readback",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"delivered_response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:53.275938+00:00",
|
||||
"issues": [],
|
||||
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
|
||||
"response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
|
||||
"response_sha256": "90a55750d86902598b8baddc1160cb61e4e69e83c54480180c8c9c736418a14d",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "demo_changes_kb_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:39:53.305948+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:02:40.932754+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "Can I demo that Leo changes the KB?",
|
||||
"prompt_id": "DC-05",
|
||||
"reply": "Yes, partially \u2014 two distinct things to show:\n\n- What's proven end-to-end: Leo writes a proposal to kb_stage via Telegram (canary add_edge proposals prove this path). Proposal appears in the ledger with a UUID and readiness state. That's a demonstrated DB write, just not to public.*.\n- What's live-proven for canonical mutation: the strict existing-ID add_edge path. Proposal 8dfedb3f already has has_apply_payload: True. If you authorize it, that edge can apply to public.claim_edges and we'd get a non-null applied_at plus a new row ID as receipt.\n- What's not yet demo-ready: approve_claim bundles (reasoning_tools, sources, claims) \u2014 that path is clone-proven, not production-proven. The Helmer proposal is blocked here.\n\nCleanest demo right now: authorize 8dfedb3f and watch the edge land in public.claim_edges with postflight row readback. Want to run that?",
|
||||
"started_at_utc": "2026-07-13T11:39:39.552016+00:00",
|
||||
"reply": "Partly.\nDB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\nProposal states are applied: 2, approved: 3, pending_review: 14. Existing receipts show applied proposal types: add_edge and attach_evidence; that receipt artifact does not prove every rich packet or chat apply path is live. You can safely demo canonical readback and a pending_review staging write. A new canonical apply requires explicit authorization, a supported strict payload, and postflight row IDs.\n\nNext proof-changing follow-up: choose the demo tier - existing applied receipt, safe staging canary, or an explicitly authorized guarded apply - then capture proposal UUID/status/applied_at, public.* before/after, and Telegram-visible regression proof.",
|
||||
"started_at_utc": "2026-07-13T12:02:27.514232+00:00",
|
||||
"turn": 5
|
||||
},
|
||||
{
|
||||
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
|
||||
"database_context_trace": [
|
||||
{
|
||||
"compiled_response_available": false,
|
||||
"compiled_response_available": true,
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"identity_canonicality_readback"
|
||||
],
|
||||
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
|
||||
"contract_sha256": "e35fe90e372b039e05a385edc11a632b3025c40179ed750eda27ed1e360970e7",
|
||||
"event": "pre_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:39:53.448528+00:00",
|
||||
"generated_at_utc": "2026-07-13T12:02:41.073797+00:00",
|
||||
"injected": true,
|
||||
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
|
||||
"source": "kb_tool.py --local context",
|
||||
|
|
@ -294,28 +309,34 @@
|
|||
{
|
||||
"compiled_response_issues": [],
|
||||
"contract_ids": [
|
||||
"reply_budget"
|
||||
"reply_budget",
|
||||
"identity_canonicality_readback"
|
||||
],
|
||||
"delivered_response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
|
||||
"delivered_response_sha256": "8350f81c2d3561793e4256c7e2514fce4fd7155e0d32d728cf72474bdf060e5e",
|
||||
"event": "post_llm_call",
|
||||
"generated_at_utc": "2026-07-13T11:40:03.097532+00:00",
|
||||
"issues": [],
|
||||
"generated_at_utc": "2026-07-13T12:02:47.356639+00:00",
|
||||
"issues": [
|
||||
"missing_identity_canonicality_boundary",
|
||||
"missing_identity_term:canonical postgres rows",
|
||||
"missing_live_count_readback:identity_canonicality_readback",
|
||||
"missing_proof_changing_followup"
|
||||
],
|
||||
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
|
||||
"response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
|
||||
"response_sha256": "9a9d1f53298b286e547a5e1133edfa8aa95c242dcdb88ca2e9430b541d844cff",
|
||||
"status": "ok",
|
||||
"transformed": false,
|
||||
"transformed": true,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"dimension": "soul_identity_direct_claim",
|
||||
"ended_at_utc": "2026-07-13T11:40:03.458478+00:00",
|
||||
"ended_at_utc": "2026-07-13T12:02:51.086958+00:00",
|
||||
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
|
||||
"mutates_kb": false,
|
||||
"ok": true,
|
||||
"prompt": "If we changed SOUL.md, did we change Leo's canonical identity?",
|
||||
"prompt_id": "DC-06",
|
||||
"reply": "No.\n\n- SOUL.md is a render from the Postgres DB, not the source. Editing the file changes what gets injected at runtime but leaves the canonical rows (personas, beliefs, strategies, strategy nodes) untouched. The DB is the identity; SOUL.md is a snapshot of it.\n- Canonical identity changes require a reviewed proposal applied through the guarded path with non-null applied_at and postflight row readback. No active general DB-to-SOUL.md renderer automation is currently proven, so the render and the DB can drift.\n- A SOUL.md edit without a matching DB write is a runtime override, not a canonical change \u2014 and it gets wiped the next time the renderer runs.",
|
||||
"started_at_utc": "2026-07-13T11:39:53.306844+00:00",
|
||||
"reply": "No.\nDB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\nA direct SOUL.md edit is a runtime/profile change; it does not change canonical Postgres rows in personas, strategies, beliefs, strategy_nodes, or strategy_node_anchors. No active general DB-to-SOUL.md renderer automation is currently proven, so neither a future render nor persistence of the edit should be assumed.\n\nNext proof-changing follow-up: audit the intended canonical identity rows and proposal UUID/status/applied_at, stage or apply the reviewed DB change with authorization, run or verify render/sync, then compare SOUL.md hash/content and restart readback.",
|
||||
"started_at_utc": "2026-07-13T12:02:40.933500+00:00",
|
||||
"turn": 6
|
||||
}
|
||||
],
|
||||
|
|
@ -330,193 +351,101 @@
|
|||
"DC-05",
|
||||
"DC-06"
|
||||
],
|
||||
"failures": [
|
||||
{
|
||||
"dimension": "db_changed_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"prompt_id": "DC-01",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"canonical_db": false,
|
||||
"no_overclaim": true,
|
||||
"proof_followup": false,
|
||||
"row_level_proof": true,
|
||||
"state_semantics": true,
|
||||
"structured_db_readback": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"dimension": "helmer_live_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"prompt_id": "DC-02",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"authorization": false,
|
||||
"canonical_db": false,
|
||||
"no_overclaim": false,
|
||||
"proof_followup": true,
|
||||
"row_level_proof": true,
|
||||
"structured_db_readback": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"dimension": "decision_matrix_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"prompt_id": "DC-03",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"canonical_db": true,
|
||||
"decision_matrix": true,
|
||||
"fresh_readback": false,
|
||||
"no_overclaim": true,
|
||||
"proof_followup": false,
|
||||
"structured_db_readback": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"dimension": "document_source_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"prompt_id": "DC-04",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"canonical_db": true,
|
||||
"document_artifact_linking": true,
|
||||
"no_overclaim": true,
|
||||
"proof_followup": false,
|
||||
"staging_or_review": true,
|
||||
"structured_db_readback": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"dimension": "demo_changes_kb_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"prompt_id": "DC-05",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"artifact": true,
|
||||
"authorization": true,
|
||||
"no_overclaim": false,
|
||||
"proof_followup": false,
|
||||
"row_level_proof": true,
|
||||
"state_semantics": false,
|
||||
"structured_db_readback": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"dimension": "soul_identity_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"prompt_id": "DC-06",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"canonical_db": true,
|
||||
"identity_rendering": true,
|
||||
"no_overclaim": false,
|
||||
"proof_followup": false,
|
||||
"row_level_proof": true,
|
||||
"structured_db_readback": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"failures": [],
|
||||
"missing_prompt_ids": [],
|
||||
"pass": false,
|
||||
"passes": 0,
|
||||
"pass": true,
|
||||
"passes": 6,
|
||||
"prompt_count": 6,
|
||||
"scores": [
|
||||
{
|
||||
"dimension": "db_changed_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"pass": true,
|
||||
"prompt_id": "DC-01",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"canonical_db": false,
|
||||
"canonical_db": true,
|
||||
"no_overclaim": true,
|
||||
"proof_followup": false,
|
||||
"proof_followup": true,
|
||||
"row_level_proof": true,
|
||||
"state_semantics": true,
|
||||
"structured_db_readback": false
|
||||
"structured_db_readback": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"dimension": "helmer_live_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"pass": true,
|
||||
"prompt_id": "DC-02",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"authorization": false,
|
||||
"canonical_db": false,
|
||||
"no_overclaim": false,
|
||||
"authorization": true,
|
||||
"canonical_db": true,
|
||||
"no_overclaim": true,
|
||||
"proof_followup": true,
|
||||
"row_level_proof": true,
|
||||
"structured_db_readback": false
|
||||
"structured_db_readback": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"dimension": "decision_matrix_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"pass": true,
|
||||
"prompt_id": "DC-03",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"canonical_db": true,
|
||||
"decision_matrix": true,
|
||||
"fresh_readback": false,
|
||||
"fresh_readback": true,
|
||||
"no_overclaim": true,
|
||||
"proof_followup": false,
|
||||
"structured_db_readback": false
|
||||
"proof_followup": true,
|
||||
"structured_db_readback": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"dimension": "document_source_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"pass": true,
|
||||
"prompt_id": "DC-04",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"canonical_db": true,
|
||||
"document_artifact_linking": true,
|
||||
"no_overclaim": true,
|
||||
"proof_followup": false,
|
||||
"proof_followup": true,
|
||||
"staging_or_review": true,
|
||||
"structured_db_readback": false
|
||||
"structured_db_readback": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"dimension": "demo_changes_kb_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"pass": true,
|
||||
"prompt_id": "DC-05",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"artifact": true,
|
||||
"authorization": true,
|
||||
"no_overclaim": false,
|
||||
"proof_followup": false,
|
||||
"no_overclaim": true,
|
||||
"proof_followup": true,
|
||||
"row_level_proof": true,
|
||||
"state_semantics": false,
|
||||
"structured_db_readback": false
|
||||
"state_semantics": true,
|
||||
"structured_db_readback": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"dimension": "soul_identity_direct_claim",
|
||||
"overclaim_detected": false,
|
||||
"pass": false,
|
||||
"pass": true,
|
||||
"prompt_id": "DC-06",
|
||||
"response_issue_detected": false,
|
||||
"signals": {
|
||||
"canonical_db": true,
|
||||
"identity_rendering": true,
|
||||
"no_overclaim": false,
|
||||
"proof_followup": false,
|
||||
"no_overclaim": true,
|
||||
"proof_followup": true,
|
||||
"row_level_proof": true,
|
||||
"structured_db_readback": false
|
||||
"structured_db_readback": true
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,62 +1,62 @@
|
|||
# Working Leo Open-Ended Benchmark Score
|
||||
|
||||
Generated UTC: `2026-07-13T11:40:14.948113+00:00`
|
||||
Generated UTC: `2026-07-13T12:03:35.440735+00:00`
|
||||
Mode: `retained_evidence_score`
|
||||
Source: `docs/reports/leo-working-state-20260709/telegram-handler-direct-claim-suite-current.json`
|
||||
Coverage: `partial`
|
||||
Overall pass for scored coverage: `False`
|
||||
Prompts scored: `0/6`
|
||||
Overall pass for scored coverage: `True`
|
||||
Prompts scored: `6/6`
|
||||
|
||||
## Scores
|
||||
|
||||
- `DC-01` / `db_changed_direct_claim`: `pass=False`
|
||||
- `DC-01` / `db_changed_direct_claim`: `pass=True`
|
||||
- `state_semantics`: `True`
|
||||
- `canonical_db`: `False`
|
||||
- `canonical_db`: `True`
|
||||
- `row_level_proof`: `True`
|
||||
- `structured_db_readback`: `False`
|
||||
- `proof_followup`: `False`
|
||||
- `structured_db_readback`: `True`
|
||||
- `proof_followup`: `True`
|
||||
- `no_overclaim`: `True`
|
||||
- `overclaim_detected`: `False`
|
||||
- `DC-02` / `helmer_live_direct_claim`: `pass=False`
|
||||
- `canonical_db`: `False`
|
||||
- `DC-02` / `helmer_live_direct_claim`: `pass=True`
|
||||
- `canonical_db`: `True`
|
||||
- `row_level_proof`: `True`
|
||||
- `structured_db_readback`: `False`
|
||||
- `authorization`: `False`
|
||||
- `structured_db_readback`: `True`
|
||||
- `authorization`: `True`
|
||||
- `proof_followup`: `True`
|
||||
- `no_overclaim`: `False`
|
||||
- `no_overclaim`: `True`
|
||||
- `overclaim_detected`: `False`
|
||||
- `DC-03` / `decision_matrix_direct_claim`: `pass=False`
|
||||
- `DC-03` / `decision_matrix_direct_claim`: `pass=True`
|
||||
- `decision_matrix`: `True`
|
||||
- `canonical_db`: `True`
|
||||
- `fresh_readback`: `False`
|
||||
- `structured_db_readback`: `False`
|
||||
- `proof_followup`: `False`
|
||||
- `fresh_readback`: `True`
|
||||
- `structured_db_readback`: `True`
|
||||
- `proof_followup`: `True`
|
||||
- `no_overclaim`: `True`
|
||||
- `overclaim_detected`: `False`
|
||||
- `DC-04` / `document_source_direct_claim`: `pass=False`
|
||||
- `DC-04` / `document_source_direct_claim`: `pass=True`
|
||||
- `document_artifact_linking`: `True`
|
||||
- `staging_or_review`: `True`
|
||||
- `canonical_db`: `True`
|
||||
- `structured_db_readback`: `False`
|
||||
- `proof_followup`: `False`
|
||||
- `structured_db_readback`: `True`
|
||||
- `proof_followup`: `True`
|
||||
- `no_overclaim`: `True`
|
||||
- `overclaim_detected`: `False`
|
||||
- `DC-05` / `demo_changes_kb_direct_claim`: `pass=False`
|
||||
- `state_semantics`: `False`
|
||||
- `DC-05` / `demo_changes_kb_direct_claim`: `pass=True`
|
||||
- `state_semantics`: `True`
|
||||
- `row_level_proof`: `True`
|
||||
- `structured_db_readback`: `False`
|
||||
- `structured_db_readback`: `True`
|
||||
- `authorization`: `True`
|
||||
- `artifact`: `True`
|
||||
- `proof_followup`: `False`
|
||||
- `no_overclaim`: `False`
|
||||
- `proof_followup`: `True`
|
||||
- `no_overclaim`: `True`
|
||||
- `overclaim_detected`: `False`
|
||||
- `DC-06` / `soul_identity_direct_claim`: `pass=False`
|
||||
- `DC-06` / `soul_identity_direct_claim`: `pass=True`
|
||||
- `identity_rendering`: `True`
|
||||
- `canonical_db`: `True`
|
||||
- `row_level_proof`: `True`
|
||||
- `structured_db_readback`: `False`
|
||||
- `proof_followup`: `False`
|
||||
- `no_overclaim`: `False`
|
||||
- `structured_db_readback`: `True`
|
||||
- `proof_followup`: `True`
|
||||
- `no_overclaim`: `True`
|
||||
- `overclaim_detected`: `False`
|
||||
|
||||
## Claim Ceiling
|
||||
|
|
|
|||
|
|
@ -22,6 +22,21 @@ from typing import Any
|
|||
|
||||
DEFAULT_CLAIM_BASE_URL = "https://leo.livingip.xyz"
|
||||
WORKER_SUPPORTED_PROPOSAL_TYPES = frozenset({"revise_strategy", "add_edge", "attach_evidence", "approve_claim"})
|
||||
DIRECT_READBACK_CONTRACTS = frozenset(
|
||||
{
|
||||
"proposal_state_readback",
|
||||
"named_packet_readback",
|
||||
"decision_matrix_readback",
|
||||
"source_link_audit",
|
||||
"demo_capability_readback",
|
||||
"identity_canonicality_readback",
|
||||
}
|
||||
)
|
||||
DECISION_MATRIX_TABLES = tuple(
|
||||
f"{schema}.{table}"
|
||||
for schema in ("public", "kb_stage")
|
||||
for table in ("matrix_voters", "proposal_votes", "proposal_decisions")
|
||||
)
|
||||
CURRENT_PUBLIC_SCHEMA = {
|
||||
"behavioral_rules": ("id", "agent_id", "category", "rank", "rule", "rationale", "created_at"),
|
||||
"beliefs": (
|
||||
|
|
@ -352,6 +367,7 @@ def operational_contracts(
|
|||
}
|
||||
]
|
||||
|
||||
decision_matrix_question = "decision matrix" in lowered or "decision-matrix" in lowered
|
||||
source_link_audit_question = (
|
||||
any(term in lowered for term in ("proposal", "pending", "approved", "stuck", "backlog"))
|
||||
and any(
|
||||
|
|
@ -360,8 +376,68 @@ def operational_contracts(
|
|||
)
|
||||
and any(term in lowered for term in ("because", "wrong", "missing", "stuck", "link", "point", "cause"))
|
||||
)
|
||||
kb_scope = "knowledge base" in lowered or bool(re.search(r"\bkb\b", lowered)) or "canonical knowledge" in lowered
|
||||
kb_implementation_question = bool(
|
||||
re.search(
|
||||
r"\b(?:scorer|benchmark|test harness|plugin|parser|implementation|search|dashboard|api|script|"
|
||||
r"function|code|tool)\b",
|
||||
lowered,
|
||||
)
|
||||
)
|
||||
proposal_lifecycle_question = any(
|
||||
term in lowered for term in ("proposal", "proposed", "pending", "approved", "applied", "staged")
|
||||
)
|
||||
broad_kb_change_question = any(
|
||||
term in lowered for term in ("changed", "change", "updated", "update", "landed", "live")
|
||||
)
|
||||
proposal_state_question = (
|
||||
"demo" not in lowered
|
||||
and kb_scope
|
||||
and (proposal_lifecycle_question or (broad_kb_change_question and not kb_implementation_question))
|
||||
)
|
||||
named_packet_question = "helmer" in lowered and any(
|
||||
term in lowered for term in ("7 powers", "seven powers", "powers framework", "powers packet")
|
||||
)
|
||||
demo_question = "demo" in lowered and (
|
||||
any(
|
||||
term in lowered
|
||||
for term in (
|
||||
"change the kb",
|
||||
"changes the kb",
|
||||
"changed the kb",
|
||||
"change the knowledge base",
|
||||
"changes the knowledge base",
|
||||
"changed the knowledge base",
|
||||
"change the database",
|
||||
"changes the database",
|
||||
"changed the database",
|
||||
)
|
||||
)
|
||||
or (
|
||||
(kb_scope or "database" in lowered)
|
||||
and any(term in lowered for term in ("write", "apply", "mutate", "stage"))
|
||||
)
|
||||
)
|
||||
identity_question = any(term in lowered for term in ("soul.md", "soul file")) and any(
|
||||
term in lowered for term in ("canonical identity", "canonical", "identity", "source of truth", "database")
|
||||
)
|
||||
primary_direct_intent = next(
|
||||
(
|
||||
intent
|
||||
for intent, enabled in (
|
||||
("decision_matrix_readback", decision_matrix_question),
|
||||
("source_link_audit", source_link_audit_question),
|
||||
("named_packet_readback", named_packet_question),
|
||||
("demo_capability_readback", demo_question),
|
||||
("identity_canonicality_readback", identity_question),
|
||||
("proposal_state_readback", proposal_state_question),
|
||||
)
|
||||
if enabled
|
||||
),
|
||||
None,
|
||||
)
|
||||
source_terms = ("document", "pdf", "tweet", "attachment", "ingest", "intake", "absorb", "extract")
|
||||
if any(term in lowered for term in source_terms) and not source_link_audit_question:
|
||||
if any(term in lowered for term in source_terms) and primary_direct_intent is None:
|
||||
contracts.append(
|
||||
{
|
||||
"id": "source_intake",
|
||||
|
|
@ -381,7 +457,7 @@ def operational_contracts(
|
|||
}
|
||||
)
|
||||
|
||||
if source_link_audit_question:
|
||||
if primary_direct_intent == "source_link_audit":
|
||||
contracts.append(
|
||||
{
|
||||
"id": "source_link_audit",
|
||||
|
|
@ -403,26 +479,7 @@ def operational_contracts(
|
|||
}
|
||||
)
|
||||
|
||||
proposal_state_question = (
|
||||
"demo" not in lowered
|
||||
and any(term in lowered for term in ("knowledge base", " kb", "kb ", "canonical knowledge"))
|
||||
and any(
|
||||
term in lowered
|
||||
for term in (
|
||||
"proposal",
|
||||
"pending",
|
||||
"approved",
|
||||
"applied",
|
||||
"updated",
|
||||
"update",
|
||||
"changed",
|
||||
"change",
|
||||
"landed",
|
||||
"live",
|
||||
)
|
||||
)
|
||||
)
|
||||
if proposal_state_question:
|
||||
if primary_direct_intent == "proposal_state_readback":
|
||||
contracts.append(
|
||||
{
|
||||
"id": "proposal_state_readback",
|
||||
|
|
@ -433,7 +490,7 @@ def operational_contracts(
|
|||
}
|
||||
)
|
||||
|
||||
if "helmer" in lowered or "7 powers" in lowered or "seven powers" in lowered:
|
||||
if primary_direct_intent == "named_packet_readback":
|
||||
contracts.append(
|
||||
{
|
||||
"id": "named_packet_readback",
|
||||
|
|
@ -445,7 +502,7 @@ def operational_contracts(
|
|||
}
|
||||
)
|
||||
|
||||
if "decision matrix" in lowered or "decision-matrix" in lowered:
|
||||
if primary_direct_intent == "decision_matrix_readback":
|
||||
contracts.append(
|
||||
{
|
||||
"id": "decision_matrix_readback",
|
||||
|
|
@ -456,9 +513,7 @@ def operational_contracts(
|
|||
}
|
||||
)
|
||||
|
||||
if "demo" in lowered and any(
|
||||
term in lowered for term in ("change", "changes", "changed", "kb", "knowledge", "database", "write", "apply")
|
||||
):
|
||||
if primary_direct_intent == "demo_capability_readback":
|
||||
contracts.append(
|
||||
{
|
||||
"id": "demo_capability_readback",
|
||||
|
|
@ -473,9 +528,7 @@ def operational_contracts(
|
|||
}
|
||||
)
|
||||
|
||||
if any(term in lowered for term in ("soul.md", "soul file")) and any(
|
||||
term in lowered for term in ("canonical identity", "canonical", "identity", "source of truth", "database")
|
||||
):
|
||||
if primary_direct_intent == "identity_canonicality_readback":
|
||||
contracts.append(
|
||||
{
|
||||
"id": "identity_canonicality_readback",
|
||||
|
|
@ -685,26 +738,79 @@ def compile_operational_response(contracts: list[dict[str, Any]]) -> str | None:
|
|||
named_packet = by_id.get("named_packet_readback")
|
||||
if named_packet:
|
||||
matches = list(named_packet.get("matching_proposals") or [])
|
||||
primary = next((item for item in matches if item.get("status") == "approved"), matches[0] if matches else None)
|
||||
primary = matches[0] if matches else None
|
||||
canonical_matches = named_packet.get("canonical_matches") or {}
|
||||
canonical_counts = {
|
||||
table: len(canonical_matches.get(table) or []) for table in ("reasoning_tools", "claims", "sources")
|
||||
}
|
||||
canonical_total = sum(canonical_counts.values())
|
||||
if primary:
|
||||
return (
|
||||
"No, Helmer's 7 Powers is not in canonical Leo yet.\n"
|
||||
f"{format_proposal_readback(primary)}\nThe packet is present in kb_stage and may be reviewer-approved, "
|
||||
"but applied_at is empty and its readiness still requires a strict apply payload; that is not a write "
|
||||
"to public.reasoning_tools, claims, sources, or claim_evidence. The packet is not applied.\n\n"
|
||||
"Next proof-changing follow-up: show the normalized packet, renew review, obtain explicit apply "
|
||||
"authorization, run the guarded apply in dependency order, then return proposal applied_at, created "
|
||||
"row IDs, public.* postflight, and the Telegram regression receipt."
|
||||
status_value = str(primary.get("status") or "unknown")
|
||||
if status_value == "approved":
|
||||
state_sentence = (
|
||||
"The exact packet is reviewer-approved in kb_stage but not applied; its readiness still requires "
|
||||
"a strict apply payload."
|
||||
)
|
||||
elif status_value == "applied":
|
||||
state_sentence = (
|
||||
"kb_stage marks the exact packet applied, but that proposal receipt does not prove which canonical "
|
||||
"rows were written."
|
||||
)
|
||||
elif status_value == "pending_review":
|
||||
state_sentence = "The exact packet remains pending_review in kb_stage and is not applied."
|
||||
else:
|
||||
state_sentence = f"The exact packet is {status_value} in kb_stage and is not a canonical apply proof."
|
||||
lead = (
|
||||
"No, Helmer's 7 Powers is not proven in canonical Leo."
|
||||
if canonical_total == 0
|
||||
else "Partly: canonical match candidates exist, but the complete Helmer's 7 Powers packet is not proven."
|
||||
)
|
||||
return (
|
||||
f"{lead}\n{format_proposal_readback(primary)}\nCanonical match readback: reasoning_tools: "
|
||||
f"{canonical_counts['reasoning_tools']}; claims: {canonical_counts['claims']}; sources: "
|
||||
f"{canonical_counts['sources']}. {state_sentence}\n\n"
|
||||
"Next proof-changing follow-up: inspect the exact canonical match row IDs, normalize and renew review "
|
||||
"if needed, obtain explicit apply authorization, then return proposal applied_at plus public.* "
|
||||
"postflight and Telegram regression proof."
|
||||
)
|
||||
return (
|
||||
"No, Helmer's 7 Powers is not proven in canonical Leo.\n"
|
||||
f"{format_database_count_readback(named_packet.get('database_status'))}\nCanonical match readback: "
|
||||
f"reasoning_tools: {canonical_counts['reasoning_tools']}; claims: {canonical_counts['claims']}; sources: "
|
||||
f"{canonical_counts['sources']}. No exact Helmer plus Powers proposal is present in kb_stage.\n\n"
|
||||
"Next proof-changing follow-up: retain the exact source artifact, stage a strict pending_review packet, "
|
||||
"obtain explicit apply authorization after review, then return proposal applied_at and public.* postflight."
|
||||
)
|
||||
|
||||
matrix = by_id.get("decision_matrix_readback")
|
||||
if matrix:
|
||||
live_matrix = matrix.get("live_matrix_status") or {}
|
||||
table_states = live_matrix.get("decision_matrix_tables") or {}
|
||||
missing = [name for name, exists in sorted(table_states.items()) if not exists]
|
||||
unobserved = [name for name in DECISION_MATRIX_TABLES if table_states.get(name) not in (True, False)]
|
||||
absent = [name for name in DECISION_MATRIX_TABLES if table_states.get(name) is False]
|
||||
if unobserved:
|
||||
return (
|
||||
f"Not proven.\n{format_database_count_readback(matrix.get('database_status'))}\nFresh readback: the "
|
||||
f"matrix table-state snapshot is incomplete; {len(unobserved)} required tables were not observed "
|
||||
f"({', '.join(unobserved)}). Their presence or absence cannot be inferred. kb_stage reviewer status "
|
||||
"is not a decision-matrix vote, so matrix approval is not proven.\n\n"
|
||||
"Next proof-changing follow-up: rerun the complete six-table schema readback, then inspect the specific "
|
||||
"proposal UUID/status/applied_at and its proposal_votes and proposal_decisions rows before claiming "
|
||||
"matrix approval."
|
||||
)
|
||||
if not absent:
|
||||
return (
|
||||
f"Not proven.\n{format_database_count_readback(matrix.get('database_status'))}\nFresh readback: all "
|
||||
"required matrix tables are present, but this snapshot does not inspect proposal-specific vote or "
|
||||
"decision rows. kb_stage reviewer status is not a decision-matrix vote, so matrix approval is not "
|
||||
"proven from proposal status alone.\n\n"
|
||||
"Next proof-changing follow-up: inspect the specific proposal UUID/status/applied_at, then return its "
|
||||
"proposal_votes and proposal_decisions rows before claiming matrix approval; otherwise use the human "
|
||||
"review and guarded canonical apply path with row-level postflight."
|
||||
)
|
||||
return (
|
||||
f"No.\n{format_database_count_readback(matrix.get('database_status'))}\nFresh readback: "
|
||||
f"{len(missing)} matrix tables are absent ({', '.join(missing)}). kb_stage reviewer status is not a "
|
||||
f"{len(absent)} matrix tables are absent ({', '.join(absent)}). kb_stage reviewer status is not a "
|
||||
"decision-matrix vote, so no proposal can be called matrix-approved from proposal status alone.\n\n"
|
||||
"Next proof-changing follow-up: inspect the specific proposal UUID/status/applied_at in kb_stage, then "
|
||||
"either show proposal_votes plus proposal_decisions for that UUID after the schema exists, or use the "
|
||||
|
|
@ -818,6 +924,145 @@ def compact_proposal(proposal: dict[str, Any]) -> dict[str, Any]:
|
|||
} | {"readiness": proposal.get("readiness") or {}}
|
||||
|
||||
|
||||
def load_direct_readback_snapshot(args: argparse.Namespace) -> dict[str, Any]:
|
||||
"""Read all broad direct-claim state from one PostgreSQL statement snapshot."""
|
||||
|
||||
sql = """
|
||||
with status_counts as (
|
||||
select coalesce(jsonb_object_agg(status, proposal_count order by status), '{}'::jsonb) as counts
|
||||
from (
|
||||
select status, count(*) as proposal_count
|
||||
from kb_stage.kb_proposals
|
||||
group by status
|
||||
) grouped
|
||||
),
|
||||
proposal_rows as (
|
||||
select p.status,
|
||||
lower(concat_ws(' ', p.rationale, p.source_ref, p.proposal_type, p.payload::text)) as search_text,
|
||||
jsonb_build_object(
|
||||
'id', p.id::text,
|
||||
'proposal_type', p.proposal_type,
|
||||
'status', p.status,
|
||||
'source_ref', p.source_ref,
|
||||
'payload', p.payload,
|
||||
'created_at', p.created_at::text,
|
||||
'reviewed_at', p.reviewed_at::text,
|
||||
'applied_at', p.applied_at::text
|
||||
) as row_value,
|
||||
p.created_at
|
||||
from kb_stage.kb_proposals p
|
||||
),
|
||||
table_status(schema_name, table_name, exists_on_vps) as (
|
||||
values
|
||||
('public', 'matrix_voters', to_regclass('public.matrix_voters') is not null),
|
||||
('public', 'proposal_votes', to_regclass('public.proposal_votes') is not null),
|
||||
('public', 'proposal_decisions', to_regclass('public.proposal_decisions') is not null),
|
||||
('kb_stage', 'matrix_voters', to_regclass('kb_stage.matrix_voters') is not null),
|
||||
('kb_stage', 'proposal_votes', to_regclass('kb_stage.proposal_votes') is not null),
|
||||
('kb_stage', 'proposal_decisions', to_regclass('kb_stage.proposal_decisions') is not null)
|
||||
),
|
||||
source_scoped as (
|
||||
select p.id,
|
||||
p.status,
|
||||
p.source_ref,
|
||||
exists (
|
||||
select 1
|
||||
from public.sources s
|
||||
where p.source_ref is not null
|
||||
and (s.id::text = p.source_ref or s.url = p.source_ref or s.storage_path = p.source_ref)
|
||||
) as exact_public_source_match
|
||||
from kb_stage.kb_proposals p
|
||||
where p.status in ('pending_review', 'approved')
|
||||
)
|
||||
select jsonb_build_object(
|
||||
'snapshot_id', txid_current_snapshot()::text,
|
||||
'statement_timestamp', statement_timestamp()::text,
|
||||
'database_status', jsonb_build_object(
|
||||
'artifact', 'teleo_kb_status',
|
||||
'backend', current_database() || '|' || current_user,
|
||||
'high_signal_rows', jsonb_build_object(
|
||||
'claims', (select count(*) from public.claims),
|
||||
'sources', (select count(*) from public.sources),
|
||||
'claim_edges', (select count(*) from public.claim_edges),
|
||||
'claim_evidence', (select count(*) from public.claim_evidence),
|
||||
'kb_proposals', (select count(*) from kb_stage.kb_proposals)
|
||||
),
|
||||
'proposal_status_counts', (select counts from status_counts)
|
||||
),
|
||||
'proposals', coalesce((
|
||||
select jsonb_agg(row_value order by created_at desc) from proposal_rows
|
||||
), '[]'::jsonb),
|
||||
'named_packet_proposals', coalesce((
|
||||
select jsonb_agg(
|
||||
row_value
|
||||
order by case status when 'applied' then 0 when 'approved' then 1
|
||||
when 'pending_review' then 2 else 3 end,
|
||||
created_at desc
|
||||
)
|
||||
from proposal_rows
|
||||
where search_text like '%helmer%' and search_text like '%power%'
|
||||
), '[]'::jsonb),
|
||||
'named_packet_canonical_matches', jsonb_build_object(
|
||||
'reasoning_tools', coalesce((
|
||||
select jsonb_agg(jsonb_build_object('id', id::text, 'name', name) order by name, id)
|
||||
from public.reasoning_tools
|
||||
where lower(concat_ws(' ', name, description)) like '%helmer%'
|
||||
and lower(concat_ws(' ', name, description)) like '%power%'
|
||||
), '[]'::jsonb),
|
||||
'claims', coalesce((
|
||||
select jsonb_agg(jsonb_build_object('id', id::text, 'status', status) order by id)
|
||||
from public.claims
|
||||
where lower(text) like '%helmer%' and lower(text) like '%power%'
|
||||
), '[]'::jsonb),
|
||||
'sources', coalesce((
|
||||
select jsonb_agg(jsonb_build_object('id', id::text, 'hash', hash) order by id)
|
||||
from public.sources
|
||||
where lower(concat_ws(' ', url, storage_path, excerpt)) like '%helmer%'
|
||||
and lower(concat_ws(' ', url, storage_path, excerpt)) like '%power%'
|
||||
), '[]'::jsonb)
|
||||
),
|
||||
'decision_matrix_status', jsonb_build_object(
|
||||
'decision_matrix_tables', (
|
||||
select jsonb_object_agg(
|
||||
schema_name || '.' || table_name,
|
||||
exists_on_vps
|
||||
order by schema_name, table_name
|
||||
)
|
||||
from table_status
|
||||
),
|
||||
'all_required_tables_present', (select bool_and(exists_on_vps) from table_status),
|
||||
'any_decision_matrix_table_present', (select bool_or(exists_on_vps) from table_status)
|
||||
),
|
||||
'source_link_audit', jsonb_build_object(
|
||||
'pending_or_approved', (select count(*) from source_scoped),
|
||||
'with_source_ref', (select count(*) from source_scoped where source_ref is not null),
|
||||
'without_source_ref', (select count(*) from source_scoped where source_ref is null),
|
||||
'exact_public_source_matches', (
|
||||
select count(*) from source_scoped where exact_public_source_match
|
||||
),
|
||||
'samples', coalesce((
|
||||
select jsonb_agg(
|
||||
jsonb_build_object(
|
||||
'proposal_id', id::text,
|
||||
'status', status,
|
||||
'source_ref', source_ref,
|
||||
'exact_public_source_match', exact_public_source_match
|
||||
)
|
||||
order by status, id
|
||||
)
|
||||
from (
|
||||
select * from source_scoped order by status, id limit 12
|
||||
) sampled
|
||||
), '[]'::jsonb)
|
||||
)
|
||||
)::text;
|
||||
"""
|
||||
rows = psql_json(args, sql)
|
||||
if not rows:
|
||||
raise SystemExit("No direct readback snapshot returned.")
|
||||
return rows[0]
|
||||
|
||||
|
||||
def load_source_link_audit(args: argparse.Namespace) -> dict[str, Any]:
|
||||
sql = """
|
||||
with scoped as (
|
||||
|
|
@ -881,38 +1126,30 @@ def context_operational_contracts(args: argparse.Namespace, query: str) -> list[
|
|||
current_constraints=load_current_public_constraints(args, table_names) if table_names else None,
|
||||
)
|
||||
contract_ids = {contract["id"] for contract in contracts}
|
||||
status_contracts = {
|
||||
"proposal_state_readback",
|
||||
"decision_matrix_readback",
|
||||
"source_link_audit",
|
||||
"demo_capability_readback",
|
||||
"identity_canonicality_readback",
|
||||
}
|
||||
status_data = status(args) if contract_ids & status_contracts else None
|
||||
proposal_rows: list[dict[str, Any]] = []
|
||||
if contract_ids & {"proposal_state_readback", "demo_capability_readback"}:
|
||||
proposal_rows = [
|
||||
compact_proposal(item)
|
||||
for item in list_proposals(argparse.Namespace(**(vars(args) | {"status": "all", "limit": 100})))
|
||||
]
|
||||
direct_snapshot = load_direct_readback_snapshot(args) if contract_ids & DIRECT_READBACK_CONTRACTS else {}
|
||||
status_data = direct_snapshot.get("database_status")
|
||||
proposal_rows = [compact_proposal(with_proposal_readiness(item)) for item in direct_snapshot.get("proposals") or []]
|
||||
|
||||
for contract in contracts:
|
||||
contract_id = contract["id"]
|
||||
if contract_id in status_contracts:
|
||||
if contract_id in DIRECT_READBACK_CONTRACTS:
|
||||
contract["database_status"] = status_data
|
||||
contract["snapshot_id"] = direct_snapshot.get("snapshot_id")
|
||||
contract["statement_timestamp"] = direct_snapshot.get("statement_timestamp")
|
||||
if contract_id == "proposal_state_readback":
|
||||
contract["applied_and_approved_proposals"] = [
|
||||
item for item in proposal_rows if item.get("status") in {"applied", "approved"}
|
||||
]
|
||||
elif contract_id == "named_packet_readback":
|
||||
result = search_proposals(
|
||||
argparse.Namespace(**(vars(args) | {"query": contract["search_query"], "status": "all", "limit": 10}))
|
||||
)
|
||||
contract["matching_proposals"] = [compact_proposal(item) for item in result.get("proposals") or []]
|
||||
contract["matching_proposals"] = [
|
||||
compact_proposal(with_proposal_readiness(item))
|
||||
for item in direct_snapshot.get("named_packet_proposals") or []
|
||||
]
|
||||
contract["canonical_matches"] = direct_snapshot.get("named_packet_canonical_matches") or {}
|
||||
elif contract_id == "decision_matrix_readback":
|
||||
contract["live_matrix_status"] = decision_matrix_status(args)
|
||||
contract["live_matrix_status"] = direct_snapshot.get("decision_matrix_status") or {}
|
||||
elif contract_id == "source_link_audit":
|
||||
contract["live_link_audit"] = load_source_link_audit(args)
|
||||
contract["live_link_audit"] = direct_snapshot.get("source_link_audit") or {}
|
||||
elif contract_id == "demo_capability_readback":
|
||||
contract["applied_proposals"] = [item for item in proposal_rows if item.get("status") == "applied"]
|
||||
return contracts
|
||||
|
|
|
|||
|
|
@ -18,6 +18,29 @@ from typing import Any
|
|||
DEFAULT_TIMEOUT_SECONDS = 10
|
||||
MAX_QUERY_CHARS = 16_000
|
||||
MAX_PENDING_SNAPSHOTS = 128
|
||||
COMPILED_CONTRACT_IDS = frozenset(
|
||||
{
|
||||
"mixed_packet_composition",
|
||||
"source_intake",
|
||||
"proposal_state_readback",
|
||||
"named_packet_readback",
|
||||
"decision_matrix_readback",
|
||||
"source_link_audit",
|
||||
"demo_capability_readback",
|
||||
"identity_canonicality_readback",
|
||||
}
|
||||
)
|
||||
DECISION_MATRIX_TABLES = tuple(
|
||||
f"{schema}.{table}"
|
||||
for schema in ("public", "kb_stage")
|
||||
for table in ("matrix_voters", "proposal_votes", "proposal_decisions")
|
||||
)
|
||||
DATABASE_UNAVAILABLE_RESPONSE = (
|
||||
"Live database readback is unavailable, so I cannot safely answer this database-state question from memory. "
|
||||
"No canonical, proposal, source, identity, or apply claim should be inferred.\n\n"
|
||||
"Next proof-changing follow-up: restore the read-only teleo-kb context lookup and rerun the exact question before "
|
||||
"any review, apply, or demo decision."
|
||||
)
|
||||
|
||||
_SNAPSHOT_LOCK = threading.Lock()
|
||||
_PENDING_SNAPSHOTS: OrderedDict[tuple[str, str], dict[str, Any]] = OrderedDict()
|
||||
|
|
@ -49,6 +72,52 @@ def _failure_context(reason: str) -> str:
|
|||
)
|
||||
|
||||
|
||||
def _requires_database_truth(query: str) -> bool:
|
||||
lowered = query.lower()
|
||||
named_packet_question = "helmer" in lowered and any(
|
||||
term in lowered for term in ("7 powers", "seven powers", "powers framework", "powers packet")
|
||||
)
|
||||
return bool(
|
||||
named_packet_question
|
||||
or re.search(
|
||||
r"\b(?:databases?|db|knowledge bases?|kb|proposals?|canonical|source_ref|source rows?|"
|
||||
r"decision[- ]matri(?:x|ces)|soul\.md|soul file|claim_evidence|claim_edges|reasoning_tools)\b|"
|
||||
r"public\.|kb_stage",
|
||||
lowered,
|
||||
)
|
||||
or any(
|
||||
term in lowered
|
||||
for term in (
|
||||
"document",
|
||||
"pdf",
|
||||
"tweet",
|
||||
"attachment",
|
||||
"ingest",
|
||||
"intake",
|
||||
"absorb",
|
||||
"extract",
|
||||
"absorb this document",
|
||||
"ingest this document",
|
||||
"compose the database",
|
||||
"strategic framework",
|
||||
"governance rule",
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def _error_snapshot(query: str, query_sha256: str, reason: str) -> dict[str, Any]:
|
||||
requires_database_truth = _requires_database_truth(query)
|
||||
return {
|
||||
"status": "error",
|
||||
"query_sha256": query_sha256,
|
||||
"contracts": [],
|
||||
"compiled_response": DATABASE_UNAVAILABLE_RESPONSE if requires_database_truth else None,
|
||||
"requires_database_truth": requires_database_truth,
|
||||
"context": _failure_context(reason),
|
||||
}
|
||||
|
||||
|
||||
def _format_context(contracts: list[dict[str, Any]]) -> str:
|
||||
payload = json.dumps(contracts, sort_keys=True, separators=(",", ":"))
|
||||
return (
|
||||
|
|
@ -102,13 +171,7 @@ def _load_database_snapshot(
|
|||
if not kb_tool.is_file():
|
||||
record = base_record | {"status": "error", "error": "kb_tool_missing", "injected": True}
|
||||
_trace(record)
|
||||
return {
|
||||
"status": "error",
|
||||
"query_sha256": query_sha256,
|
||||
"contracts": [],
|
||||
"compiled_response": None,
|
||||
"context": _failure_context("kb_tool_missing"),
|
||||
}
|
||||
return _error_snapshot(query, query_sha256, "kb_tool_missing")
|
||||
|
||||
timeout = int(os.getenv("LEO_DB_CONTEXT_TIMEOUT_SECONDS", str(DEFAULT_TIMEOUT_SECONDS)))
|
||||
command = [
|
||||
|
|
@ -129,23 +192,11 @@ def _load_database_snapshot(
|
|||
except subprocess.TimeoutExpired:
|
||||
record = base_record | {"status": "error", "error": "timeout", "injected": True}
|
||||
_trace(record)
|
||||
return {
|
||||
"status": "error",
|
||||
"query_sha256": query_sha256,
|
||||
"contracts": [],
|
||||
"compiled_response": None,
|
||||
"context": _failure_context("timeout"),
|
||||
}
|
||||
return _error_snapshot(query, query_sha256, "timeout")
|
||||
except OSError as exc:
|
||||
record = base_record | {"status": "error", "error": type(exc).__name__, "injected": True}
|
||||
_trace(record)
|
||||
return {
|
||||
"status": "error",
|
||||
"query_sha256": query_sha256,
|
||||
"contracts": [],
|
||||
"compiled_response": None,
|
||||
"context": _failure_context(type(exc).__name__),
|
||||
}
|
||||
return _error_snapshot(query, query_sha256, type(exc).__name__)
|
||||
|
||||
if completed.returncode != 0:
|
||||
record = base_record | {
|
||||
|
|
@ -154,13 +205,7 @@ def _load_database_snapshot(
|
|||
"injected": True,
|
||||
}
|
||||
_trace(record)
|
||||
return {
|
||||
"status": "error",
|
||||
"query_sha256": query_sha256,
|
||||
"contracts": [],
|
||||
"compiled_response": None,
|
||||
"context": _failure_context(f"kb_tool_exit_{completed.returncode}"),
|
||||
}
|
||||
return _error_snapshot(query, query_sha256, f"kb_tool_exit_{completed.returncode}")
|
||||
|
||||
try:
|
||||
payload = json.loads(completed.stdout)
|
||||
|
|
@ -173,13 +218,7 @@ def _load_database_snapshot(
|
|||
except (json.JSONDecodeError, TypeError, ValueError) as exc:
|
||||
record = base_record | {"status": "error", "error": str(exc), "injected": True}
|
||||
_trace(record)
|
||||
return {
|
||||
"status": "error",
|
||||
"query_sha256": query_sha256,
|
||||
"contracts": [],
|
||||
"compiled_response": None,
|
||||
"context": _failure_context(str(exc)),
|
||||
}
|
||||
return _error_snapshot(query, query_sha256, str(exc))
|
||||
|
||||
contract_json = json.dumps(contracts, sort_keys=True, separators=(",", ":"))
|
||||
record = base_record | {
|
||||
|
|
@ -195,6 +234,7 @@ def _load_database_snapshot(
|
|||
"query_sha256": query_sha256,
|
||||
"contracts": contracts,
|
||||
"compiled_response": compiled_response,
|
||||
"requires_database_truth": bool({str(item.get("id") or "") for item in contracts} - {"reply_budget"}),
|
||||
"context": _format_context(contracts),
|
||||
}
|
||||
|
||||
|
|
@ -387,13 +427,22 @@ def _live_readback_issues(response: str, contracts: list[dict[str, Any]]) -> lis
|
|||
issues.append(f"missing_live_proposal_state:{state}")
|
||||
if "approved is not applied" not in lowered or "applied_at" not in lowered:
|
||||
issues.append("missing_proposal_apply_boundary")
|
||||
if re.search(r"all approved (?:rows|proposals).{0,40}(?:already )?(?:canonical|applied|live)", response, re.I):
|
||||
issues.append("contradictory_approved_state_claim")
|
||||
|
||||
named_packet = by_id.get("named_packet_readback")
|
||||
if named_packet:
|
||||
matches = list(named_packet.get("matching_proposals") or [])
|
||||
primary = next((item for item in matches if item.get("status") == "approved"), matches[0] if matches else None)
|
||||
if not primary or not _has_proposal_readback(response, primary):
|
||||
primary = matches[0] if matches else None
|
||||
if primary and not _has_proposal_readback(response, primary):
|
||||
issues.append("missing_named_proposal_readback")
|
||||
if not primary and not _has_expected_count_readback(response, named_packet):
|
||||
issues.append("missing_named_count_readback")
|
||||
canonical_matches = named_packet.get("canonical_matches") or {}
|
||||
for table in ("reasoning_tools", "claims", "sources"):
|
||||
expected_count = len(canonical_matches.get(table) or [])
|
||||
if not _has_status_count(response, table, expected_count):
|
||||
issues.append(f"missing_named_canonical_count:{table}")
|
||||
for term in ("helmer", "canonical", "kb_stage", "applied_at", "authorization", "postflight"):
|
||||
if term not in lowered:
|
||||
issues.append(f"missing_named_packet_term:{term}")
|
||||
|
|
@ -401,9 +450,24 @@ def _live_readback_issues(response: str, contracts: list[dict[str, Any]]) -> lis
|
|||
matrix = by_id.get("decision_matrix_readback")
|
||||
if matrix:
|
||||
table_states = (matrix.get("live_matrix_status") or {}).get("decision_matrix_tables") or {}
|
||||
missing_tables = [name for name, exists in table_states.items() if not exists]
|
||||
if not missing_tables or any(name.lower() not in lowered for name in missing_tables):
|
||||
issues.append("missing_live_matrix_table_readback")
|
||||
unobserved_tables = [name for name in DECISION_MATRIX_TABLES if table_states.get(name) not in (True, False)]
|
||||
absent_tables = [name for name in DECISION_MATRIX_TABLES if table_states.get(name) is False]
|
||||
if unobserved_tables:
|
||||
if (
|
||||
any(name.lower() not in lowered for name in unobserved_tables)
|
||||
or "incomplete" not in lowered
|
||||
or "not observed" not in lowered
|
||||
or "cannot be inferred" not in lowered
|
||||
):
|
||||
issues.append("missing_live_matrix_table_readback")
|
||||
elif absent_tables:
|
||||
if any(name.lower() not in lowered for name in absent_tables):
|
||||
issues.append("missing_live_matrix_table_readback")
|
||||
else:
|
||||
if not re.search(r"all required matrix tables are present|matrix schema is present", response, re.I):
|
||||
issues.append("missing_live_matrix_table_readback")
|
||||
if "proposal-specific" not in lowered or "not proven" not in lowered:
|
||||
issues.append("missing_matrix_decision_readback_ceiling")
|
||||
if "not a decision-matrix vote" not in lowered:
|
||||
issues.append("missing_matrix_approval_boundary")
|
||||
|
||||
|
|
@ -482,34 +546,71 @@ def _post_llm_call(**kwargs: Any) -> dict[str, str] | None:
|
|||
"validated": True,
|
||||
}
|
||||
if snapshot is None:
|
||||
_trace(base_record | {"status": "error", "error": "contract_snapshot_missing", "transformed": False})
|
||||
fail_closed = _requires_database_truth(user_message)
|
||||
delivered = DATABASE_UNAVAILABLE_RESPONSE if fail_closed else response
|
||||
_trace(
|
||||
base_record
|
||||
| {
|
||||
"status": "error",
|
||||
"error": "contract_snapshot_missing",
|
||||
"transformed": fail_closed,
|
||||
"fail_closed": fail_closed,
|
||||
"delivered_response_sha256": hashlib.sha256(delivered.encode("utf-8")).hexdigest(),
|
||||
}
|
||||
)
|
||||
if fail_closed:
|
||||
return {"assistant_response": DATABASE_UNAVAILABLE_RESPONSE}
|
||||
return None
|
||||
if snapshot.get("status") != "ok":
|
||||
_trace(base_record | {"status": "skipped", "reason": "contract_lookup_failed", "transformed": False})
|
||||
fail_closed = bool(snapshot.get("requires_database_truth"))
|
||||
delivered = DATABASE_UNAVAILABLE_RESPONSE if fail_closed else response
|
||||
_trace(
|
||||
base_record
|
||||
| {
|
||||
"status": "error" if fail_closed else "skipped",
|
||||
"reason": "contract_lookup_failed",
|
||||
"transformed": fail_closed,
|
||||
"fail_closed": fail_closed,
|
||||
"delivered_response_sha256": hashlib.sha256(delivered.encode("utf-8")).hexdigest(),
|
||||
}
|
||||
)
|
||||
if fail_closed:
|
||||
return {"assistant_response": DATABASE_UNAVAILABLE_RESPONSE}
|
||||
return None
|
||||
|
||||
contracts = list(snapshot.get("contracts") or [])
|
||||
contract_ids = {str(item.get("id") or "") for item in contracts}
|
||||
issues = response_contract_issues(response, contracts)
|
||||
compiled_response = snapshot.get("compiled_response")
|
||||
compiled_issues = (
|
||||
response_contract_issues(str(compiled_response), contracts) if isinstance(compiled_response, str) else []
|
||||
)
|
||||
transformed = bool(issues and isinstance(compiled_response, str) and not compiled_issues)
|
||||
compiled_required = bool(contract_ids & COMPILED_CONTRACT_IDS)
|
||||
compiled_valid = bool(isinstance(compiled_response, str) and compiled_response.strip() and not compiled_issues)
|
||||
fail_closed = bool(compiled_required and not compiled_valid)
|
||||
enforce_compiled = bool(compiled_required and compiled_valid)
|
||||
transformed = bool(fail_closed or (enforce_compiled and str(compiled_response) != response))
|
||||
if fail_closed:
|
||||
delivered = DATABASE_UNAVAILABLE_RESPONSE
|
||||
elif enforce_compiled or (issues and compiled_valid):
|
||||
delivered = str(compiled_response)
|
||||
else:
|
||||
delivered = response
|
||||
_trace(
|
||||
base_record
|
||||
| {
|
||||
"status": "ok" if not issues or transformed else "error",
|
||||
"contract_ids": [str(item.get("id") or "") for item in contracts],
|
||||
"status": "error" if fail_closed else "ok" if not issues or delivered != response else "error",
|
||||
"contract_ids": sorted(contract_ids),
|
||||
"issues": issues,
|
||||
"compiled_response_issues": compiled_issues,
|
||||
"transformed": transformed,
|
||||
"delivered_response_sha256": hashlib.sha256(
|
||||
(str(compiled_response) if transformed else response).encode("utf-8")
|
||||
).hexdigest(),
|
||||
"compiled_response_enforced": enforce_compiled,
|
||||
"fail_closed": fail_closed,
|
||||
"delivered_response_sha256": hashlib.sha256(delivered.encode("utf-8")).hexdigest(),
|
||||
}
|
||||
)
|
||||
if transformed:
|
||||
return {"assistant_response": str(compiled_response)}
|
||||
if delivered != response:
|
||||
return {"assistant_response": delivered}
|
||||
return None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -217,6 +217,20 @@ def test_plugin_replaces_memory_only_status_answer_with_exact_live_db_receipt(tm
|
|||
"assistant_response": compiled
|
||||
}
|
||||
|
||||
alternative_valid = compiled.replace("Partly.", "Current state.")
|
||||
assert module.response_contract_issues(alternative_valid, contracts) == []
|
||||
module._store_snapshot("session-alternative", snapshot)
|
||||
assert module._post_llm_call(
|
||||
session_id="session-alternative", user_message=query, assistant_response=alternative_valid
|
||||
) == {"assistant_response": compiled}
|
||||
|
||||
contradictory = compiled + " All approved rows are already canonical."
|
||||
assert "contradictory_approved_state_claim" in module.response_contract_issues(contradictory, contracts)
|
||||
module._store_snapshot("session-contradictory", snapshot)
|
||||
assert module._post_llm_call(
|
||||
session_id="session-contradictory", user_message=query, assistant_response=contradictory
|
||||
) == {"assistant_response": compiled}
|
||||
|
||||
|
||||
def test_plugin_fails_closed_when_database_contract_lookup_fails(tmp_path: Path) -> None:
|
||||
module = load_plugin()
|
||||
|
|
@ -228,10 +242,91 @@ def test_plugin_fails_closed_when_database_contract_lookup_fails(tmp_path: Path)
|
|||
def fake_runner(command, **_kwargs):
|
||||
return subprocess.CompletedProcess(command, 9, stdout="", stderr="database unavailable")
|
||||
|
||||
context = module.build_database_context("What is live?", hermes_home=home, runner=fake_runner)
|
||||
assert 'status="unavailable"' in context
|
||||
assert "Do not infer current schema" in context
|
||||
assert "database unavailable" not in context
|
||||
query = "What is live in the knowledge base?"
|
||||
snapshot = module._load_database_snapshot(query, hermes_home=home, runner=fake_runner)
|
||||
assert 'status="unavailable"' in snapshot["context"]
|
||||
assert "Do not infer current schema" in snapshot["context"]
|
||||
assert "database unavailable" not in snapshot["context"]
|
||||
assert snapshot["requires_database_truth"] is True
|
||||
assert snapshot["compiled_response"] == module.DATABASE_UNAVAILABLE_RESPONSE
|
||||
|
||||
module._store_snapshot("session-failed", snapshot)
|
||||
assert module._post_llm_call(
|
||||
session_id="session-failed", user_message=query, assistant_response="The KB is fully current."
|
||||
) == {"assistant_response": module.DATABASE_UNAVAILABLE_RESPONSE}
|
||||
|
||||
for database_query in (
|
||||
"Has Helmer's Seven Powers framework landed as live knowledge?",
|
||||
"Does editing the SOUL file alter the source of truth for identity?",
|
||||
"I hand Leo a document. What can it absorb and stage before approval?",
|
||||
):
|
||||
failed = module._load_database_snapshot(database_query, hermes_home=home, runner=fake_runner)
|
||||
assert failed["requires_database_truth"] is True
|
||||
module._store_snapshot("session-failed-expanded", failed)
|
||||
assert module._post_llm_call(
|
||||
session_id="session-failed-expanded",
|
||||
user_message=database_query,
|
||||
assistant_response="It is already live and canonical.",
|
||||
) == {"assistant_response": module.DATABASE_UNAVAILABLE_RESPONSE}
|
||||
|
||||
|
||||
def test_database_truth_fallback_covers_every_direct_readback_question() -> None:
|
||||
module = load_plugin()
|
||||
direct_questions = (
|
||||
"Did we actually update the knowledge base, or is it still just proposals?",
|
||||
"Is Helmer's 7 Powers in Leo now?",
|
||||
"Did the decision matrix approve this already?",
|
||||
"Are the pending proposals stuck because the documents are not pointed at the right source rows?",
|
||||
"Can I demo that Leo changes the KB?",
|
||||
"If we changed SOUL.md, did we change Leo's canonical identity?",
|
||||
)
|
||||
|
||||
assert all(module._requires_database_truth(question) for question in direct_questions)
|
||||
assert module._requires_database_truth("Who is Helmer?") is False
|
||||
assert module._requires_database_truth("How are you?") is False
|
||||
|
||||
|
||||
def test_plugin_fails_closed_on_missing_snapshot_or_invalid_compiler() -> None:
|
||||
module = load_plugin()
|
||||
query = "Did an approved proposal change the knowledge base?"
|
||||
|
||||
assert module._post_llm_call(session_id="missing", user_message=query, assistant_response="Yes, it changed.") == {
|
||||
"assistant_response": module.DATABASE_UNAVAILABLE_RESPONSE
|
||||
}
|
||||
assert (
|
||||
module._post_llm_call(session_id="missing-general", user_message="How are you?", assistant_response="Fine.")
|
||||
is None
|
||||
)
|
||||
|
||||
database_status = {
|
||||
"high_signal_rows": {
|
||||
"claims": 1,
|
||||
"sources": 2,
|
||||
"claim_edges": 3,
|
||||
"claim_evidence": 4,
|
||||
"kb_proposals": 5,
|
||||
},
|
||||
"proposal_status_counts": {"applied": 1, "approved": 1, "pending_review": 2, "canceled": 1},
|
||||
}
|
||||
contracts = [
|
||||
{"id": "reply_budget", "hard_max_words": 200},
|
||||
{"id": "proposal_state_readback", "database_status": database_status},
|
||||
]
|
||||
query_sha256 = module.hashlib.sha256(query.encode("utf-8")).hexdigest()
|
||||
module._store_snapshot(
|
||||
"invalid-compiler",
|
||||
{
|
||||
"status": "ok",
|
||||
"query_sha256": query_sha256,
|
||||
"contracts": contracts,
|
||||
"compiled_response": "stale",
|
||||
"requires_database_truth": True,
|
||||
"context": "fixture",
|
||||
},
|
||||
)
|
||||
assert module._post_llm_call(
|
||||
session_id="invalid-compiler", user_message=query, assistant_response="Yes, it changed."
|
||||
) == {"assistant_response": module.DATABASE_UNAVAILABLE_RESPONSE}
|
||||
|
||||
|
||||
def test_handler_harness_retains_database_context_proof_fields() -> None:
|
||||
|
|
|
|||
|
|
@ -244,7 +244,9 @@ def test_vps_bridge_broad_db_questions_select_query_specific_live_contracts() ->
|
|||
module = _load_module(BRIDGE_DIR / "kb_tool.py")
|
||||
cases = {
|
||||
"What has actually changed in the KB rather than sitting in proposed state?": "proposal_state_readback",
|
||||
"Has the Helmer framework landed as live knowledge?": "named_packet_readback",
|
||||
"What changed in the KB?": "proposal_state_readback",
|
||||
"What has changed in the knowledge base?": "proposal_state_readback",
|
||||
"Has Helmer's Seven Powers framework landed as live knowledge?": "named_packet_readback",
|
||||
"Was that accepted through the decision-matrix?": "decision_matrix_readback",
|
||||
"Is the proposal backlog stuck on missing document-to-source links?": "source_link_audit",
|
||||
"Can we demo a real database write from Leo?": "demo_capability_readback",
|
||||
|
|
@ -256,6 +258,41 @@ def test_vps_bridge_broad_db_questions_select_query_specific_live_contracts() ->
|
|||
assert expected_id in contract_ids, query
|
||||
|
||||
|
||||
def test_vps_bridge_direct_intents_reject_unrelated_and_resolve_overlaps() -> None:
|
||||
module = _load_module(BRIDGE_DIR / "kb_tool.py")
|
||||
direct_ids = set(module.DIRECT_READBACK_CONTRACTS)
|
||||
|
||||
for query in (
|
||||
"What changed in the KB scorer?",
|
||||
"Who is Helmer?",
|
||||
"Can I demo the database dashboard?",
|
||||
"Is the KB live search broken?",
|
||||
):
|
||||
contract_ids = {item["id"] for item in module.operational_contracts(query)}
|
||||
assert not contract_ids & direct_ids, query
|
||||
|
||||
overlap_ids = {
|
||||
item["id"]
|
||||
for item in module.operational_contracts(
|
||||
"Did the decision matrix reject the pending proposal because its document pointer is missing?"
|
||||
)
|
||||
}
|
||||
assert overlap_ids & direct_ids == {"decision_matrix_readback"}
|
||||
assert "source_intake" not in overlap_ids
|
||||
|
||||
lifecycle_ids = {
|
||||
item["id"]
|
||||
for item in module.operational_contracts("What changed in the KB after the benchmark proposal was approved?")
|
||||
}
|
||||
assert lifecycle_ids & direct_ids == {"proposal_state_readback"}
|
||||
|
||||
substring_ids = {
|
||||
item["id"]
|
||||
for item in module.operational_contracts("What changed in the KB after the capital allocation update?")
|
||||
}
|
||||
assert substring_ids & direct_ids == {"proposal_state_readback"}
|
||||
|
||||
|
||||
def _direct_contract_fixtures() -> tuple[dict, dict, dict, dict]:
|
||||
database_status = {
|
||||
"high_signal_rows": {
|
||||
|
|
@ -304,11 +341,20 @@ def test_vps_bridge_enriches_and_compiles_all_direct_questions_from_live_rows(mo
|
|||
"applied_at": "2026-07-01",
|
||||
}
|
||||
|
||||
monkeypatch.setattr(module, "status", lambda _args: database_status)
|
||||
monkeypatch.setattr(module, "list_proposals", lambda _args: [approved, applied])
|
||||
monkeypatch.setattr(module, "search_proposals", lambda _args: {"proposals": [approved]})
|
||||
monkeypatch.setattr(module, "decision_matrix_status", lambda _args: matrix)
|
||||
monkeypatch.setattr(module, "load_source_link_audit", lambda _args: source_audit)
|
||||
monkeypatch.setattr(
|
||||
module,
|
||||
"load_direct_readback_snapshot",
|
||||
lambda _args: {
|
||||
"snapshot_id": "100:100:",
|
||||
"statement_timestamp": "2026-07-13T12:00:00+00:00",
|
||||
"database_status": database_status,
|
||||
"proposals": [approved, applied],
|
||||
"named_packet_proposals": [approved],
|
||||
"named_packet_canonical_matches": {"reasoning_tools": [], "claims": [], "sources": []},
|
||||
"decision_matrix_status": matrix,
|
||||
"source_link_audit": source_audit,
|
||||
},
|
||||
)
|
||||
|
||||
for prompt in M3TAVERSAL_DIRECT_CLAIM_FOLLOWUP_SCENARIOS:
|
||||
contracts = module.context_operational_contracts(SimpleNamespace(), prompt["message"])
|
||||
|
|
@ -320,6 +366,103 @@ def test_vps_bridge_enriches_and_compiles_all_direct_questions_from_live_rows(mo
|
|||
assert score["pass"] is True, score
|
||||
|
||||
|
||||
def test_vps_bridge_direct_readback_uses_one_statement_snapshot(monkeypatch) -> None:
|
||||
module = _load_module(BRIDGE_DIR / "kb_tool.py")
|
||||
database_status, approved, matrix, source_audit = _direct_contract_fixtures()
|
||||
captured_sql: list[str] = []
|
||||
expected = {
|
||||
"snapshot_id": "200:200:",
|
||||
"statement_timestamp": "2026-07-13T12:00:00+00:00",
|
||||
"database_status": database_status,
|
||||
"proposals": [approved],
|
||||
"named_packet_proposals": [approved],
|
||||
"named_packet_canonical_matches": {"reasoning_tools": [], "claims": [], "sources": []},
|
||||
"decision_matrix_status": matrix,
|
||||
"source_link_audit": source_audit,
|
||||
}
|
||||
|
||||
def fake_psql_json(_args, sql):
|
||||
captured_sql.append(sql)
|
||||
return [expected]
|
||||
|
||||
monkeypatch.setattr(module, "psql_json", fake_psql_json)
|
||||
assert module.load_direct_readback_snapshot(SimpleNamespace()) == expected
|
||||
assert len(captured_sql) == 1
|
||||
sql = captured_sql[0]
|
||||
assert "txid_current_snapshot()" in sql
|
||||
assert "named_packet_proposals" in sql
|
||||
assert "search_text like '%helmer%' and search_text like '%power%'" in sql
|
||||
assert "decision_matrix_status" in sql
|
||||
assert "source_link_audit" in sql
|
||||
|
||||
|
||||
def test_vps_bridge_named_packet_compiler_uses_observed_applied_state() -> None:
|
||||
module = _load_module(BRIDGE_DIR / "kb_tool.py")
|
||||
database_status, approved, _matrix, _source_audit = _direct_contract_fixtures()
|
||||
applied = {
|
||||
**approved,
|
||||
"status": "applied",
|
||||
"applied_at": "2026-07-01T00:00:00+00:00",
|
||||
"readiness": {"review_state": "applied"},
|
||||
}
|
||||
contracts = module.operational_contracts("Is Helmer's 7 Powers in Leo now?")
|
||||
named = next(item for item in contracts if item["id"] == "named_packet_readback")
|
||||
named.update(
|
||||
{
|
||||
"database_status": database_status,
|
||||
"matching_proposals": [applied],
|
||||
"canonical_matches": {"reasoning_tools": [], "claims": [], "sources": []},
|
||||
}
|
||||
)
|
||||
|
||||
response = module.compile_operational_response(contracts)
|
||||
assert response is not None
|
||||
assert "status: applied" in response
|
||||
assert "applied_at: 2026-07-01" in response
|
||||
assert "applied_at is empty" not in response
|
||||
assert "does not prove which canonical rows were written" in response
|
||||
|
||||
|
||||
def test_vps_bridge_matrix_compiler_handles_all_tables_present_without_overclaim() -> None:
|
||||
module = _load_module(BRIDGE_DIR / "kb_tool.py")
|
||||
database_status, _approved, matrix, _source_audit = _direct_contract_fixtures()
|
||||
matrix["decision_matrix_tables"] = {name: True for name in matrix["decision_matrix_tables"]}
|
||||
contracts = module.operational_contracts("Did the decision matrix approve this already?")
|
||||
contract = next(item for item in contracts if item["id"] == "decision_matrix_readback")
|
||||
contract.update({"database_status": database_status, "live_matrix_status": matrix})
|
||||
|
||||
response = module.compile_operational_response(contracts)
|
||||
|
||||
assert response is not None
|
||||
assert "all required matrix tables are present" in response
|
||||
assert "proposal-specific vote or decision rows" in response
|
||||
assert "matrix approval is not proven" in response
|
||||
assert "0 matrix tables are absent ()" not in response
|
||||
|
||||
|
||||
def test_vps_bridge_matrix_compiler_treats_empty_or_partial_table_state_as_unobserved() -> None:
|
||||
module = _load_module(BRIDGE_DIR / "kb_tool.py")
|
||||
database_status, _approved, _matrix, _source_audit = _direct_contract_fixtures()
|
||||
|
||||
for table_states, unobserved_count in (({}, 6), ({"public.matrix_voters": True}, 5)):
|
||||
contracts = module.operational_contracts("Did the decision matrix approve this already?")
|
||||
contract = next(item for item in contracts if item["id"] == "decision_matrix_readback")
|
||||
contract.update(
|
||||
{
|
||||
"database_status": database_status,
|
||||
"live_matrix_status": {"decision_matrix_tables": table_states},
|
||||
}
|
||||
)
|
||||
|
||||
response = module.compile_operational_response(contracts)
|
||||
|
||||
assert response is not None
|
||||
assert f"{unobserved_count} required tables were not observed" in response
|
||||
assert "presence or absence cannot be inferred" in response
|
||||
assert "matrix tables are absent" not in response
|
||||
assert "all required matrix tables are present" not in response
|
||||
|
||||
|
||||
def test_vps_bridge_source_link_audit_checks_exact_staging_to_canonical_links(monkeypatch) -> None:
|
||||
module = _load_module(BRIDGE_DIR / "kb_tool.py")
|
||||
_database_status, _approved, _matrix, source_audit = _direct_contract_fixtures()
|
||||
|
|
|
|||
Loading…
Reference in a new issue