Skip to content

feat(workflow-executor): add AI-assisted and Full AI execution to the guidance step (PRD-148 pattern, PRD-18)#1741

Draft
Scra3 wants to merge 1 commit into
mainfrom
feature/prd-18-ai-assisted-and-full-ai-guidance-task
Draft

feat(workflow-executor): add AI-assisted and Full AI execution to the guidance step (PRD-148 pattern, PRD-18)#1741
Scra3 wants to merge 1 commit into
mainfrom
feature/prd-18-ai-assisted-and-full-ai-guidance-task

Conversation

@Scra3

@Scra3 Scra3 commented Jul 7, 2026

Copy link
Copy Markdown
Member

What

Adds the 3-way Execution mode (Manual / AI-assisted / Full AI) to the Guidance step. Part of PRD-18 — 3-PR set (executor + `ForestAdmin/forestadmin-server` orchestrator + `ForestAdmin/forestadmin` editor).

  • Manual — human types + submits (unchanged); AI never called.
  • AI-assisted (automated-with-confirmation) — AI pre-fills the free-text response from the step prompt + workflow context; persisted as pendingData.userInput with an aiGenerated flag (drives the front "AI" badge); the human edits/submits.
  • Full AI (fully-automated) — AI writes and submits automatically (executionResult.userInput + generatedByAi); the response becomes a variable reusable by downstream steps.

Degrade / resilience (product-confirmed): on AI failure/timeout, or an empty draft, the step degrades to Manual (empty field, pendingData: {}) — the run never fails, the step never auto-skips. Full AI always submits on a valid draft (no low-confidence degrade — a text generator, unlike Load Related Record). The AI is never re-run on re-dispatch of the same (runId, stepIndex).

withAiAssist + logAiDegrade are hoisted from LoadRelatedRecordStepExecutor into BaseStepExecutor (2nd consumer); load-related behavior is unchanged.

Tests

Full suite green (1412). Added: Manual never calls AI; submit path never calls AI; AI-assisted pre-fill + badge flag + re-dispatch no-regen + degrade (AI failure / empty draft) + no-retry-after-degrade; Full AI submit + replay + degrade; schema (3-way, no .catch, rejects unknown); mapper (3 values + default manual). Load-related suite unchanged (hoist is behavior-neutral).

Relates to PRD-18.

🤖 Generated with Claude Code

Note

Add AI-assisted and fully automated execution modes to guidance step executor

  • GuidanceStepExecutor now supports three execution modes: Manual returns awaiting-input unchanged; AutomatedWithConfirmation uses an AI tool-call to draft a response, persists it as pendingData, and pauses for user confirmation; FullyAutomated persists the AI response as executionResult and completes.
  • AI calls are wrapped via a new BaseStepExecutor.withAiAssist helper (moved up from LoadRelatedRecordStepExecutor) that normalizes failures to AiAssistUnavailableError; empty or failed AI drafts degrade to manual by persisting an empty pendingData.
  • GuidanceStepDefinitionSchema now accepts all three execution modes explicitly and rejects unknown values; missing executionType defaults to Manual.
  • GuidanceStepExecutionData gains optional aiGenerated/generatedByAi flags and supports an empty pendingData object to signal degrade state.
  • Risk: guidance steps with invalid executionType values that were previously coerced to Manual will now be rejected outright.
📊 Macroscope summarized 720c832. 6 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@linear-code

linear-code Bot commented Jul 7, 2026

Copy link
Copy Markdown

PRD-148

PRD-18

@qltysh

qltysh Bot commented Jul 7, 2026

Copy link
Copy Markdown

1 new issue

Tool Category Rule Count
qlty Structure Function with many returns (count = 8): doExecute 1

Comment thread packages/workflow-executor/src/types/validated/step-definition.ts
Comment thread packages/workflow-executor/src/executors/guidance-step-executor.ts
@qltysh

qltysh Bot commented Jul 7, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on main by 0.01%.

Modified Files with Diff Coverage (3)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/workflow-executor/src/executors/base-step-executor.ts100.0%
Coverage rating: A Coverage rating: A
...ow-executor/src/executors/summary/step-execution-formatters.ts100.0%
Coverage rating: B Coverage rating: A
...ages/workflow-executor/src/executors/guidance-step-executor.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@Scra3 Scra3 force-pushed the feature/prd-18-ai-assisted-and-full-ai-guidance-task branch from 720c832 to 492febc Compare July 7, 2026 15:08
Comment thread packages/workflow-executor/src/types/step-execution-data.ts
… guidance step (PRD-18)

Widen GuidanceStepDefinitionSchema to the 3-way execution mode. In AI-assisted
the AI pre-fills the free-text response (persisted as pendingData with an
aiGenerated flag for the front badge) and the human submits; in Full AI the AI
writes and submits automatically (executionResult.generatedByAi). On AI failure
or an empty draft the step degrades to Manual (empty field, no auto-skip), and
the AI is never re-run on re-dispatch.

Hoist withAiAssist + logAiDegrade from LoadRelatedRecordStepExecutor into
BaseStepExecutor (2nd consumer), leaving load-related behavior unchanged.

Relates to PRD-18.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Scra3 Scra3 force-pushed the feature/prd-18-ai-assisted-and-full-ai-guidance-task branch from 492febc to cd8665f Compare July 7, 2026 15:22
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