test(agent99): align same-run learning receipts

This commit is contained in:
Your Name
2026-07-19 01:28:48 +08:00
parent 3191f0062b
commit fa3ffd01f9
3 changed files with 42 additions and 20 deletions

View File

@@ -41,6 +41,16 @@ def _evidence_refs() -> dict[str, str]:
}
def _learning_receipt_refs() -> dict[str, str]:
return {
"telegram_lifecycle_receipt_id": "telegram:1",
"km_writeback_ack_id": "knowledge:1",
"rag_writeback_ack_id": "rag:1",
"mcp_evidence_writeback_ack_id": "mcp:1",
"playbook_trust_writeback_ack_id": "playbook:1",
}
def _outcome(identity, *, transport_ok: bool = True) -> dict:
return {
"identity": identity.public_dict(),
@@ -580,11 +590,7 @@ async def test_learning_writeback_is_the_only_same_run_terminal_step(
)
incomplete = await ledger.record_learning_writeback(
identity=identity,
receipt_refs={
"telegram_lifecycle_receipt_id": "telegram:fake",
"km_writeback_ack_id": "knowledge:fake",
"playbook_trust_writeback_ack_id": "playbook:fake",
},
receipt_refs=_learning_receipt_refs(),
)
assert incomplete["status"] == (
"learning_writeback_checkpoint_incomplete_fail_closed"
@@ -592,11 +598,7 @@ async def test_learning_writeback_is_the_only_same_run_terminal_step(
assert incomplete["runtime_closure_verified"] is False
assert incomplete_db.call == 1
checkpoint_refs = {
"telegram_lifecycle_receipt_id": "telegram-1",
"km_writeback_ack_id": "km-1",
"playbook_trust_writeback_ack_id": "playbook-1",
}
checkpoint_refs = _learning_receipt_refs()
verifier_passed["learning_writeback"]["receipt_refs"] = checkpoint_refs
class LearningDB:

View File

@@ -116,11 +116,11 @@ def test_loader_returns_fixed_architecture_provider_order_and_agent99_bridge() -
"total_items": 18,
"by_priority": {"P0": 16, "P1": 2},
"by_status": {
"source_implemented_runtime_pending": 11,
"in_progress": 3,
"source_implemented_runtime_pending": 12,
"in_progress": 2,
"planned": 4,
},
"source_implemented_items": 11,
"source_implemented_items": 12,
"runtime_closed_items": 0,
"program_completion_percent": 0,
"asset_coverage_status": "partial",
@@ -141,6 +141,12 @@ def test_ledger_links_confirmed_runtime_gaps_without_false_closure() -> None:
items["AIA-SRE-013"]["runtime_gaps"]
)
assert "host99 Agent99" in " ".join(items["AIA-SRE-017"]["runtime_gaps"])
assert items["AIA-SRE-009"]["status"] == (
"source_implemented_runtime_pending"
)
assert "arbitrary commands" in " ".join(
items["AIA-SRE-009"]["confirmed_truth"]
)
assert items["AIA-SRE-011"]["status"] == (
"source_implemented_runtime_pending"
)
@@ -177,7 +183,7 @@ def test_projection_keeps_program_asset_and_runtime_truth_separate() -> None:
payload = load_sre_k3s_controlled_automation_work_items()
projection = build_sre_k3s_program_projection(payload)
assert projection["rollups"]["source_implemented_items"] == 11
assert projection["rollups"]["source_implemented_items"] == 12
assert projection["rollups"]["runtime_closed_items"] == 0
assert projection["rollups"]["program_completion_percent"] == 0
assert projection["domain_count"] == 8

View File

@@ -512,19 +512,33 @@
"title": "Windows/VMware Agent99 single-executor closure",
"owner_lane": "Agent99",
"risk": "high",
"status": "in_progress",
"status": "source_implemented_runtime_pending",
"dependencies": [
"AIA-SRE-006"
],
"source_refs": [
"apps/api/src/services/agent99_controlled_dispatch_ledger.py",
"apps/api/src/services/agent99_same_run_reconcile.py"
"apps/api/src/services/agent99_same_run_reconcile.py",
"apps/api/src/services/agent99_sre_bridge.py",
"apps/api/src/services/agent99_completion_callback.py",
"apps/api/src/services/agent99_outcome_ingestion.py",
"apps/api/src/services/agent99_public_receipts.py",
"apps/api/src/jobs/agent99_controlled_dispatch_reconciler_job.py"
],
"executor": "Agent99",
"verifier": "agent99_independent_runtime_verifier",
"rollback": "allowlisted Status/no-write reconciliation and bounded generation retry",
"exit_condition": "Windows/VMware runs use durable identity, callback, verifier and learning receipt",
"next_action": "reconcile remaining Agent99 enterprise work ledger with this program"
"confirmed_truth": [
"Windows/VMware and control-plane recovery dispatches require a typed same-run identity and Agent99 executor binding",
"unknown assets, arbitrary commands and cross-domain fallback fail closed before runtime authorization",
"authenticated completion callback persists outcome and independent verifier evidence before learning writeback",
"terminal closure requires checkpointed Telegram, KM, RAG, MCP and PlayBook acknowledgements on the same run"
],
"runtime_gaps": [
"no production Windows/VMware same-run dispatch, authenticated callback, independent verifier and complete learning closure receipt is recorded for this exact source revision"
],
"next_action": "deploy one exact source revision through the authorized Agent99 release lane, replay one allowlisted Windows/VMware run plus one cross-domain denial, then read back the same-run callback, verifier, Telegram and learning receipts; do not use arbitrary commands or fallback hosts"
},
{
"id": "AIA-SRE-010",
@@ -847,11 +861,11 @@
"P1": 2
},
"by_status": {
"source_implemented_runtime_pending": 11,
"in_progress": 3,
"source_implemented_runtime_pending": 12,
"in_progress": 2,
"planned": 4
},
"source_implemented_items": 11,
"source_implemented_items": 12,
"runtime_closed_items": 0,
"program_completion_percent": 0,
"asset_coverage_status": "partial",