Commit Graph

2 Commits

Author SHA1 Message Date
yflmq001 0816ba2f93 fix(cli): address review feedback on chat -c fail-loudly PR
Response to AI review (Enough1122) on #86812:

1. `_create_titled_session`: log the underlying exception before returning
   None so programmatic callers aren't left with an undebuggable "could
   not be created" — failures (DB lock, I/O, import) now land in errors.log
   via logger.exception.

2. Drop the source-reading `TestSourceGuard` — it violated the repo's
   "never read source code in tests" rule and was a change-detector
   (passed even if behavior regressed). The stderr routing is already
   covered by the real-path `test_missing_session_fails_on_stderr`.

3. Bare `-c` + `--create-if-missing` now prints a stderr note explaining
   the flag needs a session name, instead of silently ignoring it — makes
   the no-op self-evident to programmatic callers.

Tests: 6 targeted + 8 adjacent, all passing.
2026-08-16 06:31:26 -07:00
yflmq001 a2fcac087c fix(cli): chat -c fails loudly on stderr and gains --create-if-missing
`hermes chat -c "<title>" -q "<text>"` silently no-oped when no session
matched the title under quiet/programmatic use: the not-found message was
written to stdout (the channel quiet callers parse as the final response),
so a background send to a not-yet-existing named session vanished with no
error. Surfaces via Hermes-Bot-Mode bot-to-bot handoffs (#86794).

- not-found message now goes to stderr (exit 1 unchanged), so programmatic
  callers always see it even with -Q/--quiet
- new --create-if-missing: with `-c <title>` and no matching session, create
  a fresh session carrying the title and proceed — the deterministic
  "send to this named thread, making it if needed" primitive plugins asked for
- extract the -c resolution block into _resolve_continue_arg for testability

Tests: flag parsing, titled-session creation, stderr routing, source guard.
2026-08-16 06:31:26 -07:00