Skip to content

fix(agent): prevent fourth-tool workflow failure - #181

Merged
iamjr15 merged 1 commit into
mainfrom
fix/agent-fourth-tool-workflow
Aug 8, 2026
Merged

fix(agent): prevent fourth-tool workflow failure#181
iamjr15 merged 1 commit into
mainfrom
fix/agent-fourth-tool-workflow

Conversation

@iamjr15

@iamjr15 iamjr15 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes the deterministic fourth-tool crash caused by validating 16 rotated skill capabilities before trimming the persisted set to its 12-entry bound.
  • Routes projectless imperatives such as “build a nice pomodoro app” through the managed web app-builder unless the prompt explicitly selects mobile or a non-web runtime.
  • Adds run-scoped, redacted error telemetry and recovers known structured error codes across workflow error wrappers.

Root cause

Every checkpointed tool step minted four independently scoped runtime capabilities. The fourth step combined twelve retained capabilities with four new ones, validated the sixteen-entry intermediate array against a twelve-entry schema, and failed before the requested shell command ran. Workflow retries repeated the same deterministic validation failure.

Architecture

Capability inputs are validated independently, then the retained-plus-new set is trimmed to the durable storage bound before final validation and persistence. App-builder inference remains a narrow projectless fallback: explicit mobile signals win, explicit web signals follow, and a generic app defaults to web unless a non-web runtime is named.

Workflow terminal and pre-tool infrastructure errors now emit only allowlisted categorical metadata. Prompts, commands, provider responses, stack traces, and credentials remain excluded.

Decisions made

Decision Choice Reasoning
Capability rotation Validate new values, trim combined values, validate stored result Preserves strict boundary validation without rejecting the temporary overlap that the bound exists to prune.
Generic app routing Default imperative app requests to managed web app-builder Matches normal user language while explicit mobile and non-web signals remain authoritative.
Error transport Add a canonical Zod error-code schema and safe wrapper recovery Prevents known error classifications from collapsing solely because a platform boundary changes the Error prototype.
Failure telemetry Emit run-scoped safe classifications at pre-tool and terminal boundaries Makes exhausted retries diagnosable without retaining sensitive content.

Edge cases handled

  • Explicit mobile prompts continue to use the mobile builder.
  • CLI, backend, API, desktop, Electron, terminal, server, and library prompts remain on the general path unless an explicit web signal is present.
  • Invalid new capabilities cannot be hidden by trimming because the incoming set is validated first.
  • The unrelated dogfood-output/ working directory is not included.

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm turbo build --force
  • pnpm deadcode
  • pnpm architecture:check
  • pnpm turbo skills:build
  • Deploy the merged SHA to production
  • Exercise “build a nice pomodoro app” on production through scaffold, four-plus tool calls, dev-server start, and live preview

Trim rotated skill capabilities before enforcing the stored bound.
Route generic app requests through the managed builder and emit safe,
run-scoped workflow failure classifications.
@iamjr15
iamjr15 merged commit 5fb2bac into main Aug 8, 2026
4 checks passed
@iamjr15
iamjr15 deleted the fix/agent-fourth-tool-workflow branch August 8, 2026 11:54
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