Skip to content

feat(workflow-executor): use the step title as the AI prompt fallback#1635

Merged
Scra3 merged 1 commit into
feat/prd-214-server-step-mapperfrom
fix/workflow-thread-step-title-ai-context
Jun 8, 2026
Merged

feat(workflow-executor): use the step title as the AI prompt fallback#1635
Scra3 merged 1 commit into
feat/prd-214-server-step-mapperfrom
fix/workflow-thread-step-title-ai-context

Conversation

@Scra3

@Scra3 Scra3 commented Jun 8, 2026

Copy link
Copy Markdown
Member

What

The orchestrator sends a title on every step (ServerWorkflowStepBase.title) but the mapper dropped it. Carry it into the domain StepDefinition and, in buildContextMessage, fall back to it only when the step has no prompt.

The prompt, when present, is the authoritative intent (surfaced by each executor), so showing the title too would just be noise. The title rescues steps whose prompt arrives empty (e.g. a load-related step whose prompt is "" while the title says "Load the store").

Rule

  • prompt present → only the prompt (no title line)
  • no prompt → Step title: "<title>" is added to the context

Changes

  • add optional title to the shared StepDefinition fields
  • map task.title / condition.title in step-definition-mapper
  • buildContextMessage appends the title only when the prompt is absent
  • tests: mapper threading + the three buildContextMessage cases (fallback / prompt-wins / neither)

Small, self-contained slice extracted from the load-related work (#1630). Build + lint clean, 952 tests green.

🤖 Generated with Claude Code

Note

Use step title as AI prompt fallback in workflow executor

  • Adds an optional title field to all StepDefinition variants in step-definition.ts and propagates it through the task and condition mappers in step-definition-mapper.ts.
  • Updates BaseStepExecutor.buildContextMessage in base-step-executor.ts to append a Step title: line to the system context message when the step has no prompt; the title is omitted when a prompt is present.

Macroscope summarized 4c1b8e9.

@qltysh

qltysh Bot commented Jun 8, 2026

Copy link
Copy Markdown

1 new issue

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

@qltysh

qltysh Bot commented Jun 8, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

Unable to calculate total coverage change because base branch coverage was not found.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
New Coverage rating: A
packages/workflow-executor/src/executors/base-step-executor.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/adapters/step-definition-mapper.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.

The orchestrator sends a `title` on every step (ServerWorkflowStepBase.title)
but the mapper dropped it. Carry it into the domain StepDefinition and, in
buildContextMessage, fall back to it ONLY when the step has no prompt — the
prompt, when present, is the authoritative intent, so the title would just be
noise. This rescues steps whose prompt arrives empty (e.g. a load-related step
whose prompt is "" while the title says "Load the store").

- add optional `title` to the shared StepDefinition fields
- map `task.title` / `condition.title` in step-definition-mapper
- buildContextMessage appends `Step title: "<title>"` only when prompt is absent

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Scra3 Scra3 force-pushed the fix/workflow-thread-step-title-ai-context branch from 6fe3d3c to 4c1b8e9 Compare June 8, 2026 14:53
@Scra3 Scra3 changed the title feat(workflow-executor): thread the step title through to the AI context feat(workflow-executor): use the step title as the AI prompt fallback Jun 8, 2026
@Scra3 Scra3 merged commit 50c8244 into feat/prd-214-server-step-mapper Jun 8, 2026
30 checks passed
@Scra3 Scra3 deleted the fix/workflow-thread-step-title-ai-context branch June 8, 2026 14:59
Scra3 pushed a commit that referenced this pull request Jun 8, 2026
…RD-433 + title fallback)

Rebasing the relation-by-target-collection fusion onto a mapper that gained
PRD-426 (technical-name preRecordedArgs), PRD-433 (previousSteps-driven record
pool) and the step-title-as-prompt-fallback rule (#1635):
- pin pre-recorded relations by technical relationName, matched exactly on
  field.fieldName (drops the displayName fuzzy matchesRelation)
- tests pass loaded records via previousSteps so getAvailableRecordRefs surfaces
  them, and use select-relation-to-follow / technical names
- the step title now reaches the select-relation context only when the prompt is
  absent (fallback rule), so its test drives an empty prompt

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants