diff --git a/.gitea/workflows/run-migration.yml b/.gitea/workflows/run-migration.yml index 13b17fff..c280fc16 100644 --- a/.gitea/workflows/run-migration.yml +++ b/.gitea/workflows/run-migration.yml @@ -74,12 +74,13 @@ jobs: echo "::error::MIGRATION_DATABASE_URL secret not set in Gitea" exit 1 fi + PGURL_PSQL="${PGURL/postgresql+asyncpg:\/\//postgresql:\/\/}" # 套用每個新檔 (single transaction per file) echo "${{ steps.diff.outputs.new_files }}" | while IFS= read -r file; do [ -z "$file" ] && continue echo "=== Applying: $file ===" - psql "$PGURL" \ + psql "$PGURL_PSQL" \ -v ON_ERROR_STOP=1 \ --single-transaction \ -f "$file" @@ -91,8 +92,9 @@ jobs: env: PGURL: ${{ secrets.MIGRATION_DATABASE_URL }} run: | + PGURL_PSQL="${PGURL/postgresql+asyncpg:\/\//postgresql:\/\/}" FILES_JSON=$(echo "${{ steps.diff.outputs.new_files }}" | jq -Rn '[inputs | select(length > 0)]') - psql "$PGURL" -c " + psql "$PGURL_PSQL" -c " INSERT INTO asset_discovery_run ( run_id, triggered_by, scope, scan_depth, status, started_at, ended_at, tools_used, summary diff --git a/docs/LOGBOOK.md b/docs/LOGBOOK.md index 00a93cc1..00605e7b 100644 --- a/docs/LOGBOOK.md +++ b/docs/LOGBOOK.md @@ -37,6 +37,9 @@ Claude Code 成本評估指出真正瓶頸不是外部 AI 費用,而是同一 ### 驗證 - `python3 -m py_compile` 針對 MCP registry/audit、AI provider interface、Agent Loop、Claude/Ollama provider、DB models 通過。 - `cd apps/api && pytest tests/test_agent_loop_foundation.py tests/test_mcp_tool_registry.py tests/test_callback_dispatcher.py tests/test_openclaw_cache_key.py -q` → 64 passed。 +- `cd apps/api && pytest tests/test_agent_loop_foundation.py tests/test_mcp_tool_registry.py tests/test_pre_decision_investigator.py tests/test_callback_dispatcher.py tests/test_openclaw_cache_key.py tests/test_alertmanager_rule_bypass.py -q` → 103 passed。 +- Prod 手動套用 `adr105_mcp_audit_snapshots.sql` 通過,確認四表存在,且 `mcp_audit_log` 含 `agent_role` 欄位。 +- 修復 Gitea migration workflow:將 `postgresql+asyncpg://` 轉成 `postgresql://` 再交給 `psql`,避免 migration CI 退成 local socket。 ## 2026-05-01 | HostBackupFailed rule-first e2e 補洞