Files
Arvin Xu 394ba3a54f feat(goal): create and supervise a goal from a hetero agent conversation with /goal (#19588)
*  feat(goal): let /goal create and supervise a goal from a hetero agent conversation

- /goal in a Claude Code / Codex / Kimi conversation injects instructions to
  run `lh goal create --conversation` and plan in the same run; no goal tool.
- The server creates the goal from the running operation: the conversation
  agent supervises it, the goal is bound to the topic, and that run is adopted
  as the first planning turn (turn token returned to the CLI).
- Device and gateway runs authenticate with an operation token carrying the new
  goal:manage capability; local desktop runs use the login with their topic.
- lh hetero exec echoes LOBEHUB_OPERATION_ID / LOBEHUB_TOPIC_ID into the agent.
- Management spend counts only planning turns, not the rest of the chat.
- Conversation shows linked goals above the composer; a new Goal portal view
  shows the whole goal, and goal cards open it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* 🐛 fix(goal): keep Claude Code from taking over /goal and plan from the create output

- Strip the /goal prefix from the prompt sent to hetero CLIs. Claude Code has
  its own /goal command; sent verbatim it pinned a session goal and a stop hook
  that would not let the run end, while the LobeHub goal waited for that run to
  end before dispatching work. The instructions stay in the system context.
- Tell the agent to plan from the graph printed by lh goal create instead of
  running lh goal show, which the run's operation token cannot call.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* 🐛 fix(goal): show a goal the running conversation creates without a reload

The linked-goal tray read the topic's goals once on mount and only polled
once a goal existed, so a /goal run that created one mid-run left the tray
empty until the page reloaded. Poll while the conversation is generating.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* 🐛 fix(goal): scope goal:manage to /goal runs and keep adopted-turn spend

Codex review on #19588:
- Every hetero run got goal:manage, so an ordinary run could create goals
  through the CLI; grant it only when the prompt is a /goal request (renewal
  copies the minted claims).
- A later manager turn replaced the receipt's adopted/operationId, dropping
  the conversation run's cost from goal usage and the budget check; carry
  adoptedOperationId across turns and count it even after a topic handoff.
- The linked-goal tray polled the goal list on every generation; poll for new
  goals only while a /goal request is generating.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 01:36:58 +08:00
..