Skip to content

Bug: rootObjective does not update when user intent clearly shifts to a new task #75

Description

@tianxingzhivlog-droid

Bug Description

When a user starts with one objective (e.g., "如何开始target模式") but then shifts to completely different tasks (filing issues, pushing code), the rootObjective in Context Harness remains unchanged. This causes the system to treat all subsequent work as refinements of the original objective, leading to incorrect activeInstruction and taskEpoch management.

Reproduction

  1. Start OpenHorse, ask "如何开始target模式"
  2. rootObjective is set to "如何开始target模式"
  3. User then says "帮我提个issue给官方" — a clearly new task
  4. User then says "push项目" — another new task
  5. Check Context Harness: rootObjective is still "如何开始target模式", taskEpoch has not incremented properly

Root Cause

In intent.js, rootObjectiveChanged depends on classified.kind === "new_task", but the intent classifier (classifyIntent) uses simple keyword matching and often classifies new tasks as refine_current_task instead of new_task. This prevents rootObjective from being updated.

// Only updates root objective if classified as new_task
if (classified.kind === "new_task" && currentRootObjective !== newObjective) {
  rootObjectiveChanged = true;
}

Expected Behavior

  • When user intent clearly shifts (e.g., from "how to use target mode" to "file an issue"), rootObjective should update
  • taskEpoch should increment to reflect the new task phase
  • activeInstruction should reflect the current task, not the original one

Suggested Fix

  1. Improve intent classification to better detect task shifts (not just keyword matching)
  2. Add a secondary check: if the current user message has low semantic similarity to rootObjective, consider it a new task
  3. Allow rootObjective to be updated on refine_current_task when the refinement is clearly unrelated to the original objective
  4. Simple heuristic: if none of the key nouns/verbs in the current message overlap with rootObjective, flag as potential task shift

Environment

  • OpenHorse: v0.2.24
  • Node.js: v22.23.1
  • macOS Darwin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions