From 6f809ce116aa1b9dc405ab33ea7291db46b00886 Mon Sep 17 00:00:00 2001 From: Jesse_Chen Date: Thu, 27 Aug 2026 18:39:59 +0800 Subject: [PATCH] chore: add temporary rectification diagnostics --- .../diagnose-rectification-request.yml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .gitea/workflows/diagnose-rectification-request.yml diff --git a/.gitea/workflows/diagnose-rectification-request.yml b/.gitea/workflows/diagnose-rectification-request.yml new file mode 100644 index 00000000..680f27b2 --- /dev/null +++ b/.gitea/workflows/diagnose-rectification-request.yml @@ -0,0 +1,73 @@ +name: Diagnose rectification request (temporary) + +on: + push: + branches: + - codex/diagnose-rectification-request-20260827 + +permissions: + contents: read + +jobs: + diagnose: + runs-on: xiaoxin + timeout-minutes: 10 + env: + DEPLOY_HOST: ${{ vars.STAGING_HOST }} + DEPLOY_PORT: ${{ vars.STAGING_PORT }} + DEPLOY_USER: ${{ vars.STAGING_USER }} + DEPLOY_PATH: ${{ vars.STAGING_PATH }} + STAGING_KNOWN_HOSTS: ${{ vars.STAGING_KNOWN_HOSTS }} + REQUEST_HASH: dc94cae0e5cf998f4128a9f882cdf9b5 + CASE_HASH: 6b6659f437f3296fe54c0621b56a3052 + steps: + - name: Query redacted durable runtime state + env: + SSH_PRIVATE_KEY_BASE64: ${{ secrets.STAGING_SSH_PRIVATE_KEY }} + run: | + set -euo pipefail + ssh_root="${RUNNER_TEMP}/staging-ssh" + key_path="$ssh_root/id_ed25519" + known_hosts_path="$ssh_root/known_hosts" + install -m 700 -d "$ssh_root" + trap 'rm -rf -- "$ssh_root"' EXIT + test -n "$SSH_PRIVATE_KEY_BASE64" + printf '%s' "$SSH_PRIVATE_KEY_BASE64" | base64 --decode > "$key_path" + printf '%s\n' "$STAGING_KNOWN_HOSTS" | tr -d '\r' > "$known_hosts_path" + chmod 600 "$key_path" "$known_hosts_path" + ssh-keygen -y -f "$key_path" >/dev/null + ssh_options=(-i "$key_path" -p "$DEPLOY_PORT" -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o "UserKnownHostsFile=$known_hosts_path") + remote="$DEPLOY_USER@$DEPLOY_HOST" + ssh "${ssh_options[@]}" "$remote" "cd '$DEPLOY_PATH' && sudo -n docker compose -p jyotisha-staging -f deploy/docker-compose.postgres.yml exec -T postgres psql -X -v ON_ERROR_STOP=1 -U postgres -d jyotisha -v request_hash='$REQUEST_HASH' -v case_hash='$CASE_HASH'" <<'SQL' + \pset tuples_only on + \pset format unaligned + \echo TURN + select concat_ws('|', t.status, t.created_at, t.updated_at, (t.successful_attempt_id is not null)::text) + from public.agentic_rectification_turns t + where md5(t.request_id::text) = :'request_hash'; + \echo ATTEMPTS + select concat_ws('|', a.attempt_number::text, a.status, coalesce(a.error_code, ''), a.started_at, coalesce(a.completed_at::text, '')) + from public.agentic_rectification_run_attempts a + join public.agentic_rectification_turns t on t.id = a.turn_id + where md5(t.request_id::text) = :'request_hash' + order by a.attempt_number; + \echo PHASES + select concat_ws('|', p.sequence::text, p.phase, coalesce(p.tool_name, ''), p.created_at) + from public.agentic_rectification_run_phases p + join public.agentic_rectification_turns t on t.id = p.turn_id + where md5(t.request_id::text) = :'request_hash' + order by p.sequence; + \echo RECEIPTS + select concat_ws('|', r.tool_name, r.public_phase, r.status, coalesce(r.safe_error_code, '')) + from public.agentic_rectification_tool_receipts r + join public.agentic_rectification_turns t on t.id = r.turn_id + where md5(t.request_id::text) = :'request_hash' + order by r.started_at; + \echo CASE_STATE + select concat_ws('|', c.status, c.skill_version, c.case_revision::text, + coalesce(c.conversation_summary->'active_focus'->>'kind', 'none'), + coalesce(c.conversation_summary->'active_focus'->>'status', 'none'), + coalesce(c.conversation_summary->'active_focus'->'expected_answer_schema'->>'probe_id', 'none')) + from public.agentic_rectification_cases c + where md5(c.id::text) = :'case_hash'; + SQL