Commit Graph

5 Commits

Author SHA1 Message Date
Christian Stewart d7fe28bcbf fix(coding-agent): rejected unknown continued session ids
Treated a UUID passed after --continue as an explicit session target so a missing id cannot fall back to the latest persisted session.

Signed-off-by: Christian Stewart <christian@aperture.us>
2026-07-11 16:19:05 -07:00
usr_bin_roygbiv 3ea7e4f077 Keep JSON mode stdout clean during startup 2026-06-16 18:51:18 -05:00
can1357 24c8bb24c6 feat(session): added modular session APIs and rebuilt listing/persistence behavior
- Added session-domain modules and exports for session-entries, context, listing, loader, and migrations.
- Changed persistence to async append writes plus writeTextAtomic, removing sync line APIs.
- Added compaction-aware session context rebuild with dangling tool-call cleanup.
- Added resumable session resolution with status inference, id/stem/suffix matching, and backup recovery.
2026-06-14 02:02:53 +02:00
roboomp 54a4ca81f9 fix(cli): reject unknown --flags instead of starting an agent
Bare `omp --list-models` (or any other stale/typoed --flag) was silently
consumed by `parseArgs` and the agent went on to start a real session,
connect to the configured MCP servers, and hang waiting on the model.
Any positional after the unknown flag was reinterpreted as the initial
prompt, so a documentation drift turned into an unintended LLM invocation.

`parseArgs` now tracks flag-shaped tokens that did not match any built-in
or extension-registered flag in a new `unrecognizedFlags: string[]` field,
and `reportUnrecognizedFlags` prints a clean `Error: unknown flag(s): …`
line plus the `--help` hint. `runRootCommand` invokes the helper right
after the post-extension reparse and `process.exit(2)`s before any
session, MCP, or initial-message work runs.

The validation is gated on the extension-aware reparse, so extension
flags (`--spawn-peer`, `--headless`, `--plan`, …) still pass through
the same way `applyExtensionFlags` already handles them. `-` (stdin
marker) and `--` (POSIX separator) are deliberately allowed through.

Fixes #2459
2026-06-13 17:46:45 +00:00
roboomp 70e4cfcbf2 fix(coding-agent): convert createSessionManager throws into friendly CLI errors
`omp --resume <id>` and `omp --fork <id>` previously crashed with
`[Uncaught Exception] Error: Session "..." not found.` followed by a
stack trace whenever the id did not match an existing session. The
throws in `createSessionManager` were never caught by `runRootCommand`,
so they fell through to the global `unhandledRejection` handler in
`postmortem.ts` and printed the raw stack instead of a clean message.

Add `SessionResolutionError` (a dedicated subclass of `Error` with an
optional usage `hint`) and use it for every user-facing resolution
failure: unknown `--resume`/`--fork` id, `--fork` combined with
`--no-session`, and the non-interactive cross-project / moved-cwd
prompts. `runRootCommand` catches it around the `createSessionManager`
call, writes `Error: <msg>` (and the hint when present) to stderr, and
exits with code 1. Other (unexpected) errors still propagate so they
remain visible to the postmortem handler.

Fixes #2084
2026-06-08 03:15:50 +00:00