Skip to content

fix(tui_gateway): add /goal wait and /goal unwait command parity - #50869

Open
srojk34 wants to merge 2 commits into
NousResearch:mainfrom
srojk34:fix/tui-goal-wait-parity
Open

fix(tui_gateway): add /goal wait and /goal unwait command parity#50869
srojk34 wants to merge 2 commits into
NousResearch:mainfrom
srojk34:fix/tui-goal-wait-parity

Conversation

@srojk34

@srojk34 srojk34 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • /goal wait <pid> and /goal unwait were added to both the CLI (cli_commands_mixin.py) and gateway (slash_commands.py) in feat(goals): /goal wait <pid> — park the loop on a background process #50503, but the TUI gateway's /goal dispatcher was not updated.
  • In the TUI, /goal wait 1234 falls through to the default "set new goal" branch and silently creates a goal named "wait 1234" instead of parking the loop on PID 1234.
  • /goal unwait similarly creates a goal named "unwait".

Fix

Add the same wait / unwait subcommand parsing to tui_gateway/server.py, using the existing GoalManager.wait_on() and stop_waiting() methods and the TUI handler's _ok(rid, {type: exec, output: ...}) response convention. Logic mirrors gateway/slash_commands.py line-for-line.

Test plan

  • Open a TUI session, set a goal (/goal build the project)
  • Run /goal wait <pid> with a valid PID — verify "⏳ Goal parked" output
  • Run /goal wait with no argument — verify usage hint
  • Run /goal wait abc — verify " must be an integer" error
  • Run /goal unwait — verify "▶ Wait barrier cleared" output
  • Run /goal unwait with no barrier set — verify "No wait barrier set" output
  • Verify existing subcommands still work: /goal status, /goal pause, /goal resume, /goal clear

srojk34 added 2 commits June 22, 2026 17:56
The /goal wait <pid> barrier (ff85af3) was wired into the CLI
(cli_commands_mixin.py) and gateway (slash_commands.py) but the TUI
gateway's /goal dispatcher was not updated.  Typing /goal wait <pid> in
the TUI fell through to the default branch and silently created a new
goal named "wait <pid>" instead of parking the loop.

Add the same wait/unwait parsing to tui_gateway/server.py, using the
existing GoalManager.wait_on() and stop_waiting() methods and the TUI's
_ok(rid, {type: exec, output: ...}) response convention.
Six cases: valid pid with reason, bare /goal wait (usage hint),
non-integer pid (error), RuntimeError from GoalManager (no active
goal), /goal unwait with barrier (cleared), /goal unwait without
barrier (no-op message).
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) comp/gateway Gateway runner, session dispatch, delivery labels Jun 22, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for isolating the TUI wait-barrier parity gap. The premise remains valid on current main: tui_gateway/server.py:12160-12164 still treats unrecognized /goal input as a new goal, while the messaging gateway already implements wait/unwait at gateway/slash_commands.py:2238-2260.

Problems

  • tui_gateway/server.py:9040 in this PR slices the untrimmed arg, although the branch predicate uses arg.strip().lower() (current main: tui_gateway/server.py:12128). A direct RPC request with arg=" wait 123" matches the wait branch but produces "t 123", causing a false invalid-PID response.

Suggested changes

  • Normalize the argument once and use that normalized value for wait parsing; add a whitespace-prefixed wait case in the current focused suite, tests/tui_gateway/test_goal_command.py.

Automated hermes-sweeper review.

Comment thread tui_gateway/server.py
)

# /goal wait <pid> [reason] — park the loop on a background process.
if lower == "wait" or lower.startswith("wait "):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lower was derived from arg.strip(), but this slices the untrimmed arg. A direct command.dispatch request with arg=" wait 123" matches the wait branch yet turns into "t 123". Slice arg.strip() (or a precomputed normalized argument) and add coverage.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants