#!/bin/zsh set -euo pipefail export PATH=$PATH:/usr/local/bin WORK_ITEM_UUID="91f095ed-07ed-43db-9af3-1d99ef136d14" export WORK_ITEM_UUID MILESTONE_ID="plane-origin-milestone-creation-smoke-test" CORE_URL="http://127.0.0.1:18010" # Plane config loading cd "$HOME/agent-work/nomadcode/services/core" set -a; source ../../.env.plane.local; set +a echo "=== Core Task API ===" curl -fsS "$CORE_URL/api/tasks?source=plane" >/tmp/nomadcode-plane-tasks.json python3 - <<'PY' import json, os work_item = os.environ.get("WORK_ITEM_UUID", "038ca3ac-bda6-4466-b73f-7874e1e4f925") with open("/tmp/nomadcode-plane-tasks.json", encoding="utf-8") as f: data = json.load(f) tasks = data if isinstance(data, list) else data.get("tasks", []) matches = [t for t in tasks if t.get("external_id") == work_item] print("matching_tasks:", len(matches)) for task in matches[-3:]: meta = task.get("metadata", {}) checkout = meta.get("checkout", {}) print("task_id:", task.get("id")) print("status:", task.get("status")) print("slot_id:", checkout.get("slot_id")) print("authoring_run_state:", meta.get("authoring_run_state")) print("wait_type:", meta.get("wait_type")) PY echo "=== Plane Work Item ===" curl -fsS -H "X-Api-Key: $PLANE_TOKEN" "$PLANE_BASE_URL/api/v1/workspaces/$PLANE_WORKSPACE_SLUG/projects/$PLANE_PROJECT_ID/work-items/$WORK_ITEM_UUID/" >/tmp/plane-work-item.json python3 - <<'PY' import json with open("/tmp/plane-work-item.json", encoding="utf-8") as f: item = json.load(f) print("plane_id:", item.get("id")) print("plane_name:", item.get("name")) state = item.get("state") state_id = item.get("state_id") if isinstance(state, dict): state_id = state_id or state.get("id") elif isinstance(state, str): state_id = state_id or state print("plane_state_id:", state_id) print("description_html_len:", len(item.get("description_html") or "")) PY echo "=== Plane Comments ===" curl -fsS -H "X-Api-Key: $PLANE_TOKEN" "$PLANE_BASE_URL/api/v1/workspaces/$PLANE_WORKSPACE_SLUG/projects/$PLANE_PROJECT_ID/work-items/$WORK_ITEM_UUID/comments/" >/tmp/plane-comments.json || true python3 - <<'PY' import json try: with open("/tmp/plane-comments.json", encoding="utf-8") as f: data = json.load(f) except Exception as exc: print("comments_unavailable:", exc) else: if isinstance(data, dict): rows = data.get("results", []) else: rows = data print("comment_count:", len(rows)) PY echo "=== Docker Logs ===" docker compose logs --no-color --since=6h nomadcode-core | rg "gito .*sync enqueued|roadmap creation sync completed|plane_todo_moved|authoring|push|workspace slot" || true echo "=== DB Sync Steps ===" docker exec -i code-server-postgres psql -U nomadcode -d nomad-core-dev -c "select i.roadmap_item_id, i.work_item_id, s.step, s.completed_at from roadmap_sync_identities i join roadmap_sync_steps s on s.roadmap_sync_identity_id = i.id where (i.work_item_id = '$WORK_ITEM_UUID' or i.roadmap_item_id = '$MILESTONE_ID') order by s.completed_at desc limit 60;" echo "=== DB Tasks ===" docker exec -i code-server-postgres psql -U nomadcode -d nomad-core-dev -c "select id, source, external_id, status, metadata->>'authoring_run_state' as authoring_run_state, metadata->'checkout'->>'slot_id' as slot_id, updated_at from tasks where external_id = '$WORK_ITEM_UUID' or updated_at > now() - interval '6 hours' order by updated_at desc limit 30;" echo "=== DB Slots ===" docker exec -i code-server-postgres psql -U nomadcode -d nomad-core-dev -c "select id, state, path, updated_at from workspace_slots order by id;"