fix(hooks): surface unreadable active task records (#544) - #545
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe workflow-state hooks now distinguish invalid task records from absent active-task pointers. They return ChangesWorkflow-state task errors
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change is merge-ready after normal checks and review; no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant WorkflowStateHook
participant TaskRecord
participant WorkflowTemplate
WorkflowStateHook->>TaskRecord: Read task.json
TaskRecord-->>WorkflowStateHook: Return invalid or unusable record
WorkflowStateHook->>WorkflowTemplate: Select task_error breadcrumb
WorkflowTemplate-->>WorkflowStateHook: Provide repair guidance
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Reviewed — the fix is right and I want to merge it, with one gap worth closing first. The fixDistinguishing "the record cannot be read" from "there is no task" is the correct call, and the failure mode it prevents is the expensive one: the model was being told It also does not make the hook noisier — The gapThe PR adds the So after merging, a user with a corrupt The header — the part that stops the duplicate-task behaviour — works. But the diagnostic body your description promises never appears; the specific wording in the test ( The fallback is deliberate design (the docstring is explicit that workflow.md is the only source of truth and a missing tag should degrade visibly rather than be masked), so this is incomplete rather than broken. Could you add the Ping when that is in and I will merge. |
|
Checking back on this one — I think my earlier request may have read as already satisfied, so to be concrete about what is still missing. The So the tests demonstrate the hook renders the block correctly if one exists, but no such block ships. A real user with a corrupt What is needed is a The rest of the PR is good and I want it in — the hook change is correct, the three copies are byte-identical, and stopping the duplicate-task behaviour is the valuable part. This is the last piece. |
Distinguish an active task with a missing, malformed, or invalid task.json from a session with no active task. Preserve the task directory in the breadcrumb so the model can repair the existing record instead of creating a duplicate task. Add regression coverage for malformed JSON, missing status, and non-object records. Refs: mindfold-ai#544
fd25b40 to
a93ff5c
Compare
|
Thanks, I forgot to follow up. I’ve added the missing shipped It now tells the agent to repair the existing active task record and explicitly prevents creating or activating another task. I also updated the workflow status map/table and added a template-level regression assertion, so this behavior is now verified against the bundled workflow rather than only a test fixture. The native marketplace mirror is byte-identical and is available in the companion PR: Local verification:
|
Summary
Fix the workflow-state hook so an existing active task with an unreadable task record is not reported as
no_task.When the session pointer resolves to a task directory whose
task.jsonis missing, malformed, not an object, or has no usablestatus, the hook now emitsTask: <task> (task_error). This preserves the task identity and gives the model a diagnostic state instead of encouraging duplicate task creation.The behavior is synchronized across the shared template, Claude hook, and Codex hook. The runtime contract now documents
task_erroras a reachable pseudo-status.Closes #544
Testing
git diff --checkScope
Regression Coverage
statusStatus: no_taskSummary by CodeRabbit
Bug Fixes
task_errorstatus when task details are missing, unreadable, malformed, non-object, or incomplete.Tests