teleo-infrastructure/docs/reports/leo-working-state-20260709/telegram-handler-count-receipt-correction-current.json
2026-07-13 07:13:08 +02:00

100 lines
6.8 KiB
JSON

{
"before_service": {
"ActiveState": "active",
"ExecMainStartTimestamp": "Mon 2026-07-13 04:26:31 UTC",
"MainPID": "1105322",
"NRestarts": "0",
"SubState": "running"
},
"changed_live_profile": false,
"correction_score": {
"invalid_count_invariant_detected": false,
"pass": true,
"signals": {
"all_tables_addressed": true,
"edge_only_case": true,
"existing_evidence_case": true,
"packet_specific_receipt": true,
"proposal_state_not_count": true,
"rejects_blanket_invariant": true
}
},
"db_counts_after": {
"kb_stage.kb_proposals": 26,
"public.claim_edges": 4916,
"public.claim_evidence": 4670,
"public.claims": 1837,
"public.sources": 4145
},
"db_counts_before": {
"kb_stage.kb_proposals": 26,
"public.claim_edges": 4916,
"public.claim_evidence": 4670,
"public.claims": 1837,
"public.sources": 4145
},
"db_counts_changed": false,
"generated_at_utc": "2026-07-13T04:43:33.865659+00:00",
"handler": {
"authorized": true,
"session_key": "agent:main:telegram:group:-5146042086:9070919",
"temp_profile": "/tmp/leo-direct-claim-handler-14mrctcj/profile"
},
"harness_notes": [
"Adversarial read-only correction of the blanket five-count apply invariant.",
"The harness uses a temporary copy of the leoclean profile and does not post to Telegram.",
"This proves handler-level live VPS GatewayRunner behavior, not human-visible Telegram delivery."
],
"mode": "live_vps_gatewayrunner_temp_profile_count_receipt_correction",
"mutates_kb_by_harness": false,
"pass": true,
"pass_runtime": true,
"posted_to_telegram": false,
"remote_report_path": "/tmp/leo-count-receipt-correction-8983ff213c77.json",
"remote_returncode": 0,
"remote_run_id": "8983ff213c77",
"results": [
{
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"dimension": "self_correction_and_packet_specific_receipt",
"ended_at_utc": "2026-07-13T04:44:26.146589+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false,
"ok": true,
"prompt": "Earlier you said, 'All five numbers must move' after an apply. Is that actually a valid invariant? Correct or defend it table by table for public.claims, public.sources, public.claim_edges, public.claim_evidence, and kb_stage.kb_proposals. Include an attach-evidence packet that reuses an existing claim and source, and an edge-only packet. State the universal receipt contract that proves an apply succeeded. Read-only: do not stage, approve, apply, or edit anything.",
"prompt_id": "COUNT-RECEIPT-01",
"reply": "Good challenge. The \"all five numbers must move\" claim is wrong. Let me correct it table by table using live counts, then give you the two counter-packet examples and the real receipt contract.\n\nDB readback: claims: `1837`; sources: `4145`; claim_edges: `4916`; claim_evidence: `4670`; kb_proposals: `26`.\n\n---\n\nTABLE-BY-TABLE VERDICT\n\npublic.claims\nMoves only if a NEW claim row is inserted. Packets that attach evidence to an existing claim or add an edge between two existing claims leave this count unchanged.\nVerdict: conditional.\n\npublic.sources\nMoves only if a NEW source row is inserted. Packets that reuse an existing source leave this count unchanged.\nVerdict: conditional.\n\npublic.claim_edges\nMoves only if a NEW edge row is inserted. Packets that add a claim+evidence with no edges leave this count unchanged.\nVerdict: conditional.\n\npublic.claim_evidence\nMoves only if a NEW evidence link is inserted. Edge-only packets (connecting two existing claims) leave this count unchanged.\nVerdict: conditional.\n\nkb_proposals\nThe kb_proposals COUNT does not change on apply at all. The proposal row already exists and is counted. What changes is the row's `status` field (pending_review -> approved -> applied) and `applied_at` timestamp. The count breakdown shifts (approved -1, applied +1), but the total row count stays at 26.\nVerdict: never a count increment.\n\n---\n\nCOUNT INVARIANT IS FALSE\n\n\"All five numbers must move\" fails in every packet type except a maximally rich new-claim-new-source-with-edges packet. Even there, kb_proposals total count still doesn't increment.\n\n---\n\nCOUNTER-PACKET EXAMPLES\n\nAttach-evidence packet (reusing existing claim C1 and source S1):\n- claims: 0 (C1 already exists)\n- sources: 0 (S1 already exists)\n- claim_evidence: +1 (new link row C1 -> S1)\n- claim_edges: 0 (no edge declared)\n- kb_proposals: 0 count change (row updated, not inserted)\n\nEdge-only packet (connecting existing claim C1 to claim C2):\n- claims: 0\n- sources: 0\n- claim_evidence: 0\n- claim_edges: +1 (new edge C1 -> C2)\n- kb_proposals: 0 count change\n\n---\n\nUNIVERSAL RECEIPT CONTRACT\n\nAn apply succeeded if and only if:\n\n1. `kb_proposals.status` = `applied` for the proposal UUID\n2. `kb_proposals.applied_at` is non-null (the timestamp is the apply event)\n3. Every row ID named in the `apply_payload` exists in the corresponding canonical `public.*` table with the expected content\n\nThe receipt is the applied_at timestamp plus the specific row IDs. Not a count delta. Counting is only useful as a sanity check that the right number of net-new rows appeared \u2014 and that number is zero for some tables in every valid packet type.\n\n---\n\nCorrection stands: I should not have stated that invariant. The original statement was imprecise and would reject valid apply receipts for attach-evidence and edge-only packets.\n\nNext Cory-style follow-up: pick a real approved proposal UUID and verify its apply_payload names the right canonical row IDs \u2014 that is what a live receipt audit would look like.",
"started_at_utc": "2026-07-13T04:43:34.332284+00:00",
"turn": 1
}
],
"scored_at_utc": "2026-07-13T04:45:35.411443+00:00",
"service_before_after": {
"after": {
"ActiveState": "active",
"ExecMainStartTimestamp": "Mon 2026-07-13 04:26:31 UTC",
"MainPID": "1105322",
"NRestarts": "0",
"SubState": "running"
},
"before": {
"ActiveState": "active",
"ExecMainStartTimestamp": "Mon 2026-07-13 04:26:31 UTC",
"MainPID": "1105322",
"NRestarts": "0",
"SubState": "running"
},
"unchanged_from_preexisting_live_readback": true
},
"service_unchanged": true,
"source": {
"chat_id": "-5146042086",
"chat_name": "Leo",
"chat_type": "group",
"platform": "telegram",
"user_id": "9070919",
"user_name": "codex handler direct claim"
},
"source_report_path": "/Users/user/Documents/Codex/2026-07-09/019f34eb-d297-72d0-b7e2-b222d5515ab9-load/work/teleo-infra-main/docs/reports/leo-working-state-20260709/telegram-handler-count-receipt-correction-current.json",
"temp_profile_removed": true
}