fix(telegram): close ops direct sender gaps
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 2m6s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped

This commit is contained in:
Your Name
2026-07-02 19:32:30 +08:00
parent 8cfede071b
commit b191f8e9fe
26 changed files with 330 additions and 2642 deletions

View File

@@ -86,6 +86,12 @@ def _with_live_telegram_egress_guard(payload: dict[str, Any]) -> dict[str, Any]:
ai_route_missing_count = sum(
1 for item in live_calls if item.get("ai_controlled_route_state") != "ai_controlled_gateway_route_ready"
)
ai_agent_next_action = (
"create_controlled_migration_work_items_for_direct_bot_api_routes_with_db_receipt_"
"verifier_and_km_playbook_writeback"
if live_calls
else "bind_gateway_alert_cards_to_learning_writeback_receipts"
)
updated["telegram_egress_guard"] = {
"schema_version": "telegram_notification_egress_no_new_bypass_guard_v1",
@@ -136,10 +142,7 @@ def _with_live_telegram_egress_guard(payload: dict[str, Any]) -> dict[str, Any]:
if item.get("evidence_persistence_state")
}
),
"ai_agent_next_action": (
"create_controlled_migration_work_items_for_direct_bot_api_routes_with_db_receipt_"
"verifier_and_km_playbook_writeback"
),
"ai_agent_next_action": ai_agent_next_action,
},
"current_direct_bot_api_calls": live_calls,
"ai_agent_interpretation": {
@@ -150,7 +153,11 @@ def _with_live_telegram_egress_guard(payload: dict[str, Any]) -> dict[str, Any]:
"all_direct_routes_have_awooop_db_receipt": receipt_missing_count == 0,
"all_direct_routes_have_ai_controlled_route": ai_route_missing_count == 0,
"manual_default_outcome_allowed": False,
"next_action": "migrate_direct_bot_api_calls_to_awoooi_api_or_telegram_gateway_receipts",
"next_action": (
"migrate_direct_bot_api_calls_to_awoooi_api_or_telegram_gateway_receipts"
if live_calls
else "bind_gateway_alert_cards_to_learning_writeback_receipts"
),
},
}

View File

@@ -336,11 +336,12 @@ _COMMANDER_INSERTED_REQUIREMENT_WORK_ITEMS: list[dict[str, Any]] = [
),
"current_state": (
"Telegram alert AI automation matrix endpoint 已實作channel_hub API direct sender 已改走 "
"TelegramGateway / AwoooP outbound receipt path目前明確讀回 workflow direct send 0、"
"ops script direct gap 4、API direct gap 0"
"TelegramGateway / AwoooP outbound receipt pathscripts/ops 4 條 legacy direct Bot API fallback "
"已改為 AWOOI API / TelegramGateway receipt path目前明確讀回 workflow direct send 0"
"ops script direct gap 0、API direct gap 0。"
),
"acceptance": "Telegram alert matrix 顯示 total、DB receipt、AI route、controlled queue、manual/default gap 與 direct send gap。",
"next_action": "收斂 scripts/ops 內剩餘 4 條 direct Bot API sendMessage 到 AWOOI API / TelegramGateway receipt path",
"next_action": "把 gateway AI alert card delivery receipt 接到 KM / PlayBook learning writeback readback驗證 Telegram 不再是人工終局",
"mapped_workplan_id": "P0-006",
},
{

View File

@@ -86,6 +86,8 @@ def load_latest_telegram_alert_ai_automation_matrix(
direct_gap_file_count = int(egress_summary["direct_bot_api_file_count"])
api_direct_gap_count = int(egress_summary["api_direct_bot_api_call_count"])
ops_script_gap_count = int(egress_summary["ops_script_direct_bot_api_call_count"])
migration_candidate_count = int(migration_summary["migration_candidate_count"])
direct_gap_closed = direct_gap_count == 0
direct_gap_refs = [
{
"surface_id": item["egress_surface_id"],
@@ -121,13 +123,37 @@ def load_latest_telegram_alert_ai_automation_matrix(
"surface_id": "telegram_direct_bot_api_egress_gap",
"priority_work_item_id": "CIR-P0-TG-001",
"surface_kind": "direct_bot_api_gap",
"status": "gap_open_requires_controlled_migration",
"status": (
"gap_closed_no_direct_bot_api_routes_detected"
if direct_gap_closed
else "gap_open_requires_controlled_migration"
),
"known_item_count": direct_gap_count,
"db_or_log_receipt": "missing_or_not_proven_for_direct_path",
"ai_route": "missing_or_not_proven_for_direct_path",
"controlled_queue": "missing_or_not_proven_for_direct_path",
"post_verifier": "metadata_inventory_ready",
"learning_writeback": "migration_candidate_ready_not_applied",
"db_or_log_receipt": (
"ready_no_direct_routes_remaining"
if direct_gap_closed
else "missing_or_not_proven_for_direct_path"
),
"ai_route": (
"ready_no_direct_routes_remaining"
if direct_gap_closed
else "missing_or_not_proven_for_direct_path"
),
"controlled_queue": (
"no_direct_migration_queue_needed"
if direct_gap_closed
else "missing_or_not_proven_for_direct_path"
),
"post_verifier": (
"metadata_inventory_clear"
if direct_gap_closed
else "metadata_inventory_ready"
),
"learning_writeback": (
"ready_bind_gateway_receipts_to_learning_writeback"
if direct_gap_closed
else "migration_candidate_ready_not_applied"
),
"manual_default_gap_count": direct_gap_count,
"direct_send_gap_count": direct_gap_count,
"evidence_refs": [
@@ -157,13 +183,37 @@ def load_latest_telegram_alert_ai_automation_matrix(
"surface_id": "telegram_egress_controlled_migration_candidates",
"priority_work_item_id": "CIR-P0-TG-001",
"surface_kind": "migration_candidate",
"status": "controlled_apply_candidates_ready",
"known_item_count": int(migration_summary["migration_candidate_count"]),
"db_or_log_receipt": "required_before_candidate_close",
"ai_route": "migration_plan_ready",
"controlled_queue": "ready_for_controlled_apply_review",
"post_verifier": "owner_acceptance_ledger_ready",
"learning_writeback": "candidate_acceptance_metadata_ready",
"status": (
"controlled_migration_complete_no_candidates"
if migration_candidate_count == 0
else "controlled_apply_candidates_ready"
),
"known_item_count": migration_candidate_count,
"db_or_log_receipt": (
"ready_no_direct_migration_candidates"
if migration_candidate_count == 0
else "required_before_candidate_close"
),
"ai_route": (
"ready_no_direct_migration_candidates"
if migration_candidate_count == 0
else "migration_plan_ready"
),
"controlled_queue": (
"no_direct_migration_queue_needed"
if migration_candidate_count == 0
else "ready_for_controlled_apply_review"
),
"post_verifier": (
"owner_acceptance_ledger_clear"
if migration_candidate_count == 0
else "owner_acceptance_ledger_ready"
),
"learning_writeback": (
"ready_bind_gateway_receipts_to_learning_writeback"
if migration_candidate_count == 0
else "candidate_acceptance_metadata_ready"
),
"manual_default_gap_count": 0,
"direct_send_gap_count": direct_gap_count,
"evidence_refs": [
@@ -244,8 +294,16 @@ def load_latest_telegram_alert_ai_automation_matrix(
"next_controlled_actions": next_controlled_actions,
"operator_interpretation": [
"TelegramGateway AI alert cards already expose AI route, controlled queue, final-exit formatter, outbound mirror metadata, and readback endpoint support.",
"Known direct Bot API surfaces remain the concrete AI automation gap; API direct senders are clear when api_direct_send_gap_count is 0.",
"Manual/default semantics are only acceptable for critical/break-glass or historical evidence; direct send gaps remain controlled migration candidates.",
(
"Known direct Bot API surfaces are clear; keep future Telegram sends on the gateway receipt path."
if direct_gap_closed
else "Known direct Bot API surfaces remain the concrete AI automation gap; API direct senders are clear when api_direct_send_gap_count is 0."
),
(
"Manual/default semantics are only acceptable for critical/break-glass or historical evidence; the next P0 step is learning/writeback readback."
if direct_gap_closed
else "Manual/default semantics are only acceptable for critical/break-glass or historical evidence; direct send gaps remain controlled migration candidates."
),
],
}