Files
Linux_post_install/AgentsReport/builder/2026-09-06_alias-menu-fix.md
T
Your Name 8ce54794ee
gates / consistency-and-conventions (push) Successful in 27s
fix: pos ai alias create aborts on empty system prompt — menu_ask_value --allow-empty
User report: pressing Enter on 'System prompt (empty = use built-in)'
silently returned to the menu — no alias created, and step labels read
[1/4] [2/4] in a 5-step flow.

Detective (pre-existing, not a 2026-09-06 regression): menu_ask_value's
documented contract is 'rc 1 = cancel, or empty answer with no default';
the step-4 call passed an empty default so the advertised empty answer
hit rc 1 and '|| return 0' aborted the flow. Same latent trap at the
alias-name step (empty-name warn/re-prompt was dead code). 11 other
call sites are correct (6 external rely on empty=cancel, 4 pass
defaults) — no global semantic change allowed.

Architect: opt-in --allow-empty flag on menu_ask_value (backward
compatible; empty+no-default -> rc 0 + empty value; genuine cancel/EOF
stays rc 1; default still wins). Builder: implemented in lib/menu-lib.sh
+ bin/pos-ai-alias (steps 1-2 relabeled /5, flag at the two approved
sites); 7-case smoke matrix PASS.

Tests: tests/t-menu-allow-empty.sh (30 checks) — semantics matrix
against the real menu_ask_value via non-TTY stdin, reader-contract
probes (empty-Enter rc 0 vs EOF rc 1), static guards on step labeling,
the exactly-2 flag call sites, edit-flow untouched, and a scope fence
over all pos-* tools. Pty E2E proven feasible (script -qec, 3 scenarios)
and documented in the Tester report; the E2E file itself remains a
follow-up.

Verified: make gen idempotent; make check OK; make lint 0 FAIL, 0 WARN;
make test 17 files / 299 checks / 0 fail / 0 skip (~49s); bash -n clean.
2026-09-07 02:04:30 -04:00

2.8 KiB
Raw Blame History

Builder Report — Alias Menu Fix (2026-09-06)

TL;DR

  • Status: IMPLEMENTED
  • Files changed: lib/menu-lib.sh, bin/pos-ai-alias, AgentsReport/builder/2026-09-06_alias-menu-fix.md
  • Verification: bash -n OK; make gen ×2 (deterministic, no drift); make check OK; make lint 0 FAIL 0 WARN; functional smoke 7/7 pass.
  • Summary: Added --allow-empty flag to menu_ask_value, switched 2 alias call sites (353, 410), fixed step counters 352/383 → /5.

Step 1: Update function index line in lib/menu-lib.sh

Updated line 27: menu_ask_value <label> [default]menu_ask_value [--allow-empty] <label> [default]. [DONE]

Step 2: Add --allow-empty documentation to menu_ask_value doc block

Added doc line (after line 349) documenting the flag: empty+no-default → rc 0 + empty value; only cancel/EOF returns rc 1. [DONE]

Step 3: Implement --allow-empty flag in menu_ask_value body

Implemented per architect reference (--allow-empty parsed as first arg, shift; empty branch: default→echo+rc 0; no default → allow_empty rc 0 echo empty / else rc 1; cancel always rc 1). Prompt label display unchanged (default suffix only when non-empty). [DONE]

Step 4: Fix step counters and add --allow-empty to pos-ai-alias call sites

  • line 352: step 1 4step 1 5
  • line 353: added --allow-empty flag (kept || return 0)
  • line 383: step 2 4step 2 5
  • line 410: added --allow-empty flag (kept || return 0) [DONE]

Step 5: Verification (bash -n, make gen, make check, make lint, functional smoke)

  • bash -n lib/menu-lib.sh → OK; bash -n bin/pos-ai-alias → OK.
  • make gen run twice → both write OK, no gen drift (git diff after gen shows ONLY the 2 source files, no generated blocks touched) → byte-identical on rerun = deterministic.
  • make check → check-sync: OK.
  • make lint0 FAIL, 0 WARN.
  • Functional smoke (non-TTY harness at /tmp/opencode/menu_smoke.sh, sources lib/menu-lib.sh):
    • empty-no-default no flag → rc 1 (contract unchanged) PASS
    • empty-no-default with flag → rc 0 + empty PASS
    • empty-with-default with flag → rc 0 + default (default wins) PASS
    • empty-with-default no flag → rc 0 + default PASS
    • non-empty with flag → rc 0 + value PASS
    • non-empty no flag → rc 0 + value PASS
    • EOF (no input) with flag → rc 1 (cancel stays cancel) PASS
    • TOTAL: 7 pass, 0 fail.
  • Alias-name re-prompt reachability (static): line 353 now returns rc 0 + "" on empty Enter → line 355 [ -z "$name" ] fires → warn "Alias name cannot be empty"continue → re-prompt (step 1 5 shown again); genuine cancel → rc 1 → || return 0 → abort to menu. Verified reachable by design; TTY-level end-to-end create-flow run is a Tester/manual check per Architect's note. [DONE]

Handoff

Status: IMPLEMENTED (see final message) [DONE]