From d1e909b51954faa1b710bc2956709c60e0961114 Mon Sep 17 00:00:00 2001 From: Zhichao Date: Wed, 8 Jul 2026 11:27:56 +0800 Subject: [PATCH 1/3] ci(spec-sync): raise AI turn cap and give the agent exploration tools The inaugural dispatch hit error_max_turns at 40 turns (incomplete wiring, 2 permission denials) because the agent could not explore the codebase (only Bash(rye *)/Bash(./scripts/*) were allowed, no Glob/Grep/read-only shell). - --max-turns 40 -> 250 (wiring a full resource like parse_jobs is large) - allowedTools += Glob, Grep, Bash(git diff:*) so the agent explores natively; still no git write/push capability (prompt-injection hardening intact) - prompt now tells it to read the diff + parse_jobs.py first and run lint/format Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/spec-sync.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/spec-sync.yml b/.github/workflows/spec-sync.yml index 2970c1a..072bb09 100644 --- a/.github/workflows/spec-sync.yml +++ b/.github/workflows/spec-sync.yml @@ -110,16 +110,22 @@ jobs: github_token: ${{ secrets.SPEC_SYNC_TOKEN }} prompt: | The previous commit updated specs/v1-ade.json and regenerated reference models in - specs/_generated/v1_models.py. Edit the SDK to match the spec diff: add or adjust - resource classes, method signatures, param TypedDicts, response models, tests, api.md, - and README examples, mirroring the conventions in - src/landingai_ade/resources/parse_jobs.py. Then run `./scripts/format`. + specs/_generated/v1_models.py. Wire the SDK to match the spec diff. + + First inspect `git diff` of the previous commit and read + src/landingai_ade/resources/parse_jobs.py — mirror its structure exactly for any + new resource (sync + async classes, the raw/streaming response wrappers, param + TypedDicts under src/landingai_ade/types/, response models, and registration in + src/landingai_ade/resources/__init__.py and the client). Add tests under + tests/api_resources/ and update api.md and the README examples. Then run + `./scripts/format` and `./scripts/lint` and fix anything they report. + Rules: PURELY ADDITIVE — never modify or remove an existing public signature (the surface-lock CI job will fail the PR). Do NOT run git or push; a later workflow step commits and pushes your edits. claude_args: | - --max-turns 40 - --allowedTools "Edit,Write,Read,Bash(rye *),Bash(./scripts/*)" + --max-turns 250 + --allowedTools "Edit,Write,Read,Glob,Grep,Bash(rye *),Bash(./scripts/*),Bash(git diff:*)" # Deterministic: commit whatever the AI edited and push to the sync branch. This guarantees # the AI changes actually reach the PR (the action's automation mode does not push), and it From 1aa69e94eed4325fbda5fdc1703ef8f49bacc2cb Mon Sep 17 00:00:00 2001 From: Zhichao Date: Wed, 8 Jul 2026 11:33:31 +0800 Subject: [PATCH 2/3] ci(spec-sync): resolve prompt git-diff contradiction; bump job timeout to 60m Addresses Copilot review on #103: - prompt: clarify 'git diff' (read-only) is allowed while stage/commit/push/other git is not (previously 'inspect git diff' + 'do NOT run git' read as contradictory) - timeout-minutes 30 -> 60 so a long --max-turns 250 AI run isn't killed by the job timeout Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/spec-sync.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/spec-sync.yml b/.github/workflows/spec-sync.yml index 072bb09..8206924 100644 --- a/.github/workflows/spec-sync.yml +++ b/.github/workflows/spec-sync.yml @@ -18,7 +18,7 @@ jobs: # secrets and would just produce noisy failing runs. if: github.repository == 'landing-ai/ade-python' runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 60 # headroom for the AI wiring step (up to --max-turns 250) plus rye sync env: V1_SPEC_URL: https://api.va.staging.landing.ai/v1/ade/openapi.json # staging drives the loop SYNC_BRANCH: spec-sync/v1 # fixed branch: reruns update one PR in place, never a pile of them @@ -121,8 +121,9 @@ jobs: `./scripts/format` and `./scripts/lint` and fix anything they report. Rules: PURELY ADDITIVE — never modify or remove an existing public signature (the - surface-lock CI job will fail the PR). Do NOT run git or push; a later workflow step - commits and pushes your edits. + surface-lock CI job will fail the PR). `git diff` (read-only, to inspect the change) + is fine; do NOT stage, commit, push, or run any other git command — a later workflow + step commits and pushes your edits. claude_args: | --max-turns 250 --allowedTools "Edit,Write,Read,Glob,Grep,Bash(rye *),Bash(./scripts/*),Bash(git diff:*)" From caf7a3e9ba9db68fd5706ec892113ed60986c173 Mon Sep 17 00:00:00 2001 From: Zhichao Date: Tue, 7 Jul 2026 20:35:26 -0700 Subject: [PATCH 3/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/spec-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spec-sync.yml b/.github/workflows/spec-sync.yml index 8206924..d49bcb8 100644 --- a/.github/workflows/spec-sync.yml +++ b/.github/workflows/spec-sync.yml @@ -112,7 +112,7 @@ jobs: The previous commit updated specs/v1-ade.json and regenerated reference models in specs/_generated/v1_models.py. Wire the SDK to match the spec diff. - First inspect `git diff` of the previous commit and read + First inspect the mechanical commit diff (`git diff HEAD~1..HEAD`) and read src/landingai_ade/resources/parse_jobs.py — mirror its structure exactly for any new resource (sync + async classes, the raw/streaming response wrappers, param TypedDicts under src/landingai_ade/types/, response models, and registration in