fix(tui): add missing draft and show subcommands to /goal - #55301
fix(tui): add missing draft and show subcommands to /goal#55301alaamohanad169-ship-it wants to merge 1 commit into
Conversation
Competing/overlapping cluster for #54985 (TUI |
|
Note: This is NOT a duplicate of the prior closed PRs (#54985, #55012, #50869, #55012). |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
TUI goal handler now supports draft and show subcommands matching CLI behavior.
Looks Good
- Small addition: 17 lines adding missing subcommands
- Consistent with existing CLI handler pattern
- No tests but the change is straightforward string matching
teknium1
left a comment
There was a problem hiding this comment.
Thanks for narrowing this to the TUI parity gap. The gap still exists on current main: tui_gateway/server.py:12128-12169 has no show or draft branches and falls through to setting a new goal.
Problems
tui_gateway/server.py:11519calls_gm.draft_contract(objective), butdraft_contractis a module-level helper (hermes_cli/goals.py:987), not aGoalManagermethod. This makes every draft request return the 5030 error from the enclosingexcept.tui_gateway/server.py:11521usesset_contract, which returnsNonewithout an existing goal (hermes_cli/goals.py:1160-1169)./goal draftneeds to create the goal, and the TUI must return the normalsendpayload (tui_gateway/server.py:12175-12177) to start its first turn.
Suggested changes
- Call module-level
draft_contract, then usemgr.set(objective, contract=contract)and return a normalsendresponse; preserve the CLI fallback when drafting is unavailable. - Add gateway tests for
show, draft success, and draft fallback.
Automated hermes-sweeper review.
| try: | ||
| from hermes_cli.goals import GoalManager as _GM | ||
| _gm = _GM(session_id=sid_key, default_max_turns=max_turns) | ||
| contract = _gm.draft_contract(objective) |
There was a problem hiding this comment.
draft_contract is a module-level helper in hermes_cli.goals, not a GoalManager method. This call raises AttributeError and the enclosing handler returns 5030 for every /goal draft request; import and call draft_contract(objective) directly.
| _gm = _GM(session_id=sid_key, default_max_turns=max_turns) | ||
| contract = _gm.draft_contract(objective) | ||
| if contract: | ||
| _gm.set_contract(contract) |
There was a problem hiding this comment.
set_contract() only attaches to an existing active goal and returns None when no goal exists. /goal draft <objective> should instead create the goal with mgr.set(objective, contract=contract) and return the normal TUI send payload so the goal starts.
The TUI gateway goal handler only supported status, pause, resume, and clear. The CLI handler also supports draft and show subcommands, but the TUI fell through to 'set as new goal' for unrecognized subcommands. Added draft and show subcommand handling to match the CLI behavior. Fixes #54985
c8e8c0d to
b847d8c
Compare
The TUI gateway goal handler only supported status, pause, resume, and clear. The CLI handler also supports draft and show subcommands, but the TUI fell through to set as new goal for unrecognized subcommands.
Added draft and show subcommand handling to match the CLI behavior.
Fixes #54985