Skip to content

feat(cad): iterate on failing KCL in retries and add Zoo engine prompt guardrails - #47

Merged
alanshen27 merged 1 commit into
mainfrom
devin/1785976625-zoo-retry-guardrails
Aug 6, 2026
Merged

feat(cad): iterate on failing KCL in retries and add Zoo engine prompt guardrails#47
alanshen27 merged 1 commit into
mainfrom
devin/1785976625-zoo-retry-guardrails

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Cuts the dominant cost in long text_to_cad runs: a self-heal retry used to call cad.textToCad again with an empty main.kcl, so Zoo rewrote the whole part from scratch (the ~15-minute rear_cover retry in the analyzed logs). Retries now patch the failing script instead, and every prompt carries guardrails for the engine limits Zoo's model keeps hitting.

  • text_to_cad retry path in tools.ts:
    attempt > 1 && lastKcl
      ? cad.iterateCad(lastKcl, buildFixIteratePrompt(job.prompt, lastError))   // edit_kcl_code — patch the failing file
      : cad.textToCad(attempt > 1 ? buildRegeneratePrompt(...) : withKclGuardrails(job.prompt))
    
    lastKcl is captured when engine verification fails; generation-level failures (no KCL produced) still regenerate.
  • New apps/web/lib/cad/zoo-guardrails.tsKCL_ENGINE_GUARDRAILS appended to all generation prompts:
    • no boolean union()/subtract() of separate solids (model one closed-profile extrusion, cut from it) — matches the The Zoo engine cannot handle this 3D union/subtraction yet failures;
    • point() takes no construction argument — a recurring model hallucination.

Tests

  • zoo-guardrails.test.ts covers withKclGuardrails, buildRegeneratePrompt, buildFixIteratePrompt.
  • pnpm --filter @foundry/web test (484), lint, typecheck, format all pass.

Link to Devin session: https://app.devin.ai/sessions/d846e91524fc43aca04de9649aeb2300
Requested by: @alanshen27

…t guardrails

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@alanshen27 alanshen27 self-assigned this Aug 6, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@alanshen27
alanshen27 merged commit b2536cc into main Aug 6, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant