DEBUG: post captured --format json schema as an issue comment (findable + fetchable)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
da6f0d5b92
commit
d0ddb06ccb
@@ -174,22 +174,28 @@ jobs:
|
||||
"### comment by \($who):\n\(.body)\n"' > /tmp/thread.md 2>/dev/null || true
|
||||
echo "thread comments fetched: $(grep -c '^### comment by ' /tmp/thread.md 2>/dev/null || echo 0)"
|
||||
|
||||
# TEMPORARY: capture opencode's --format json event schema so we can build the PR-progress
|
||||
# parser. Runs a tiny tool-using probe with Sonnet, dumps the events, then this step is removed.
|
||||
# TEMPORARY: capture opencode's --format json event schema and POST it as an issue comment
|
||||
# (easier to find than reusable-workflow step logs). Removed once captured.
|
||||
- name: DEBUG capture --format json schema
|
||||
env:
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
GT: ${{ secrets.GITEA_TOKEN }}
|
||||
NUM: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
cd /tmp && rm -f probe.txt
|
||||
opencode run --model anthropic/claude-sonnet-5 --auto --format json \
|
||||
"Create a file /tmp/probe.txt containing the word hi, then say one sentence about what you did." \
|
||||
> /tmp/events.jsonl 2>/tmp/events.err || true
|
||||
echo "=== lines: $(wc -l < /tmp/events.jsonl) ==="
|
||||
echo "=== distinct top-level event types ==="
|
||||
jq -rc '.type // (keys|join("+"))' /tmp/events.jsonl 2>/dev/null | sort | uniq -c
|
||||
echo "=== every event (compact, truncated to 600 chars/line) ==="
|
||||
jq -c '.' /tmp/events.jsonl 2>/dev/null | cut -c1-600 || cat /tmp/events.jsonl
|
||||
echo "=== stderr tail ==="; tail -15 /tmp/events.err
|
||||
n=$(wc -l < /tmp/events.jsonl)
|
||||
types=$(jq -rc '.type // (keys|join("+"))' /tmp/events.jsonl 2>/dev/null | sort | uniq -c)
|
||||
examples=$(jq -s -c 'map(select(type=="object" and .type!=null)) | group_by(.type) | map(.[0])[]' /tmp/events.jsonl 2>/dev/null | cut -c1-700)
|
||||
[ -z "$examples" ] && examples=$(head -c 3000 /tmp/events.jsonl)
|
||||
body=$(printf 'DEBUG opencode --format json — %s events\n\n**types:**\n```\n%s\n```\n\n**one example per type:**\n```\n%s\n```\n\n**stderr tail:**\n```\n%s\n```' \
|
||||
"$n" "$types" "$examples" "$(tail -8 /tmp/events.err)")
|
||||
API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
||||
curl -sS -X POST -H "Authorization: token $GT" -H "Content-Type: application/json" \
|
||||
"$API/issues/$NUM/comments" -d "$(jq -nc --arg b "$body" '{body:$b}')" \
|
||||
-w '\ndebug comment -> HTTP %{http_code}\n' || true
|
||||
|
||||
- name: Run agent
|
||||
id: run
|
||||
|
||||
Reference in New Issue
Block a user