Skip to content

fix: resolve clarification workflow reset in multi-turn planning#84

Open
MaxLinCode wants to merge 3 commits intomainfrom
claude/clarification-workflow-fix
Open

fix: resolve clarification workflow reset in multi-turn planning#84
MaxLinCode wants to merge 3 commits intomainfrom
claude/clarification-workflow-fix

Conversation

@MaxLinCode
Copy link
Copy Markdown
Owner

Summary

  • Add parentTargetRef to clarification entities and pending clarifications, creating a back-pointer from the clarification to the original write target
  • Populate parentTargetRef when creating clarifications, enforce one-open-per-workflow by closing prior pending clarifications
  • resolveWriteTarget now reads parentTargetRef from the open clarification instead of focus_entity_id for clarification answers, preventing workflow reset

Context

When a user said "schedule gym for tomorrow" → assistant asked "what time?" → user answered "10am, 30min", the system was losing the day field and originatingText. Root cause: focus_entity_id pointed at the clarification entity (a question, not a write target), causing applyWriteCommit to detect a target change and wipe accumulated fields.

Test Plan

  • 5 new clarification schema tests (parentTargetRef parsing, defaults, backward compat)
  • 26 turn-router tests pass (including new clarification_answer target resolution)
  • 13 conversation-state tests pass (including parentTargetRef population)
  • Full suite: 156/156 tests pass
  • Typecheck clean across all packages

🤖 Generated with Claude Code

MaxLinCode and others added 3 commits April 9, 2026 11:10
…cation schemas

Clarification entities and pending clarifications now carry a parentTargetRef
field that back-references the write workflow's target. Uses
.optional().default(null) for backward compatibility with existing records.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-open-per-workflow

When creating a clarification entity, copy the targetRef from the current
pending_write_operation into parentTargetRef. Close any prior open
clarifications before creating a new one to enforce a single active
clarification per workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… focus_entity_id

For clarification_answer turns, resolve the write target from the open
clarification's parentTargetRef instead of focus_entity_id (which may
point at the clarification entity itself). Also parse entity registries
at the turn-router and decide-turn-policy boundaries to apply Zod
defaults for the new parentTargetRef field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
atlas-web Ignored Ignored Apr 9, 2026 11:01pm

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