Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions terminal/menus/mq-agent-menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ print_agent_review_brain_menu() {
surface_panel_header "Review to Brain" "mq-agent" "$width" "$panel_color"
surface_row "WRITES TO mqobsidian" "$width" "$panel_color"
surface_split_row "1. Review repo → brain" "2. Signal + save to brain" "$width" "$panel_color"
surface_split_row "3. Stack truth export → brain" "" "$width" "$panel_color"
surface_split_row "b. Back" "" "$width" "$panel_color"
surface_row "" "$width" "$panel_color"
surface_row "Status: ready" "$width" "$panel_color"
Expand All @@ -596,6 +597,9 @@ agent_review_brain_menu_loop() {
case "$choice" in
1) _run_agent review repo . --brain; pause_enter ;;
2) _run_agent signal --brain .; pause_enter ;;
# The note the stack sweep reports on. Nothing schedules it, so the only
# thing keeping it fresh is an operator finding this row.
3) _run_agent stack truth-export; pause_enter ;;
b|B|x|X|exit) return ;;
*) printf "%b Invalid selection:%b %s\n" "${C_ERR:-}" "${C_RESET:-}" "$choice"; pause_enter ;;
esac
Expand Down
36 changes: 23 additions & 13 deletions tests/mq-agent-routing-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ DOC="$ROOT/docs/COMMANDS.md"

echo "SMOKE: mq-agent review routing boundary"

echo "[1/13] files exist"
echo "[1/14] files exist"
test -f "$AGENT_MENU"
test -f "$COMMAND_MODE"

echo "[2/13] shell syntax"
echo "[2/14] shell syntax"
bash -n "$AGENT_MENU"
bash -n "$COMMAND_MODE"

echo "[3/13] review delegates to mq-agent review command group"
echo "[3/14] review delegates to mq-agent review command group"
grep -q "_run_agent review diff" "$AGENT_MENU"
grep -q "_run_agent review file" "$AGENT_MENU"
grep -q "_run_agent review repo" "$AGENT_MENU"

echo "[4/13] risk review uses mq-agent risk flag"
echo "[4/14] risk review uses mq-agent risk flag"
grep -q "_run_agent review diff --risk" "$AGENT_MENU"

echo "[5/13] repo health targets macos-scripts by default"
echo "[5/14] repo health targets macos-scripts by default"
grep -q 'repo_path=\$repo_path' "$AGENT_MENU"
grep -q 'MQ_REPO_HEALTH_PATH:-\$BASE_DIR' "$AGENT_MENU"

echo "[6/13] mqlaunch command mode exposes top-level routes"
echo "[6/14] mqlaunch command mode exposes top-level routes"
grep -q "run_agent_command review" "$COMMAND_MODE"
grep -q "run_agent_command architecture" "$COMMAND_MODE"
grep -q "run_agent_command risk-review" "$COMMAND_MODE"
Expand All @@ -42,7 +42,7 @@ grep -q "run_agent_command mcp-status" "$COMMAND_MODE"
# neither proved anything about the boundary in the first place. A roadmap is a
# plan, and rewriting it is its job. The contract lives in docs/COMMANDS.md and
# in the routes asserted above.
echo "[7/13] docs describe delegation boundary"
echo "[7/14] docs describe delegation boundary"
grep -q "review current diff via mq-agent -> mq-mcp" "$DOC"
grep -q "mqlaunch stack status" "$DOC"
grep -q 'mq-agent stack status' "$DOC"
Expand Down Expand Up @@ -79,15 +79,15 @@ expect_translation() {
fi
}

echo "[8/13] review translates the operator vocabulary to mq-agent flags"
echo "[8/14] review translates the operator vocabulary to mq-agent flags"
expect_translation "mq-agent review diff" # scope defaults to diff
expect_translation "mq-agent review repo" repo
expect_translation "mq-agent review file lib/x.sh" file lib/x.sh
expect_translation "mq-agent review file lib/x.sh --security" file lib/x.sh security
expect_translation "mq-agent review diff --architecture" diff architecture
expect_translation "mq-agent review repo --risk" repo --mode risk

echo "[9/13] mq-agent's own options survive the translation"
echo "[9/14] mq-agent's own options survive the translation"
# `--repo <path>` is a real mq-agent option on `review file`: the external repo
# the file lives in. mqlaunch must pass it through rather than read it as a
# scope word, or the option is unreachable from the launcher.
Expand Down Expand Up @@ -126,7 +126,7 @@ expect_dispatch() {
fi
}

echo "[10/13] stack forwards every verb to mq-agent, and bare stack means status"
echo "[10/14] stack forwards every verb to mq-agent, and bare stack means status"
expect_dispatch "mq-agent stack status" stack
expect_dispatch "mq-agent stack status" stack status
expect_dispatch "mq-agent stack status --json" stack status --json
Expand All @@ -140,7 +140,7 @@ expect_dispatch "mq-agent stack truth-export" stack truth-export
# subcommand would need a mqlaunch change to become reachable.
expect_dispatch "mq-agent stack brain-gate --strict" stack brain-gate --strict

echo "[11/13] the delegate's exit code survives the route"
echo "[11/14] the delegate's exit code survives the route"
# `mqlaunch stack --json` really does fail: --json is an option on the
# subcommands, not on the group, so mq-agent exits 2. A launcher that swallowed
# that would make the failure invisible to a script.
Expand Down Expand Up @@ -194,7 +194,7 @@ expect_cli() {
fi
}

echo "[12/13] srm delegates every verb to mq-agent, including the read paths"
echo "[12/14] srm delegates every verb to mq-agent, including the read paths"
expect_cli "mq-agent memory-search vector store upload flow" srm search vector store upload flow
expect_cli "mq-agent memory-search what is indexed here" srm ask what is indexed here
expect_cli "mq-agent memory-status" srm inspect
Expand All @@ -208,7 +208,7 @@ expect_cli "mq-agent memory-review-status" srm review-status
expect_cli "mq-agent memory-promote-from-review 7" srm promote-from-review 7
expect_cli "mq-agent memory-resolve-supersede 9" srm resolve-supersede 9

echo "[13/13] the retired local AI path is gone and unknown words fail clearly"
echo "[13/14] the retired local AI path is gone and unknown words fail clearly"
if [[ -e "$ROOT/tools/scripts/srm.sh" ]]; then
echo "FAIL: tools/scripts/srm.sh is back — the local OpenAI path was retired" >&2
exit 1
Expand All @@ -232,4 +232,14 @@ case "$out" in
esac
echo " ok: srm.sh is gone, no AI fallback, unknown verbs print usage"

echo "[14/14] the interactive menu exposes the truth export, not just command mode"
# `mqlaunch stack truth-export` has always worked, but the export was reachable
# only by typing it. The stack sweep reports the note as stale without offering
# any way to refresh it, which is how it went fourteen days without running.
grep -q "Stack truth export" "$AGENT_MENU"
grep -Eq "^\s*[0-9]+\) _run_agent stack truth-export;" "$AGENT_MENU" || {
echo "FAIL: no agent menu option routes to stack truth-export" >&2
exit 1
}

echo "OK: mq-agent review routing boundary smoke test passed"
Loading