[GH-ISSUE #7289] [Issue]: Professor Mari chat actions fail for chat ids that start with -- #4064

Closed
opened 2026-10-21 06:09:58 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SpicyMarinara on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7289

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Professor Mari's structured chat.* app_data actions cannot read a chat whose id starts with --. Chat ids are 21-character nanoids, so about 1 chat in 4096 starts with -- (1/64²). For those chats, chat.get and chat.messages fail with Usage: mari chats get <id>, and chat.list with a character id that starts with -- silently ignores the filter.

This also makes scripts/regressions/mari/chat-app-data.regression.ts flaky in CI, because the fixture chat gets a fresh nanoid on every run.

Expected behavior

chat.get, chat.messages, chat.list (with characterId) and chat.search treat the chat id, character id, or query as a value whatever its first characters are.

Actual behavior

executeChatAction (packages/server/src/services/mari-db/mari-db.service.ts) turns the structured action back into CLI argv ([sub, <chatId>, --flag, value]) and hands it to executeChatsCommand, whose parseArgs (line 849) treats any argument starting with -- as a flag. The chat id disappears from the positionals:

  • chat.get / chat.messages throw Usage: mari chats get <id> / Usage: mari chats messages <chat-id> ....
  • chat.list with characterId: "--…" pushes --character --…; the value is read as another flag, --character becomes true, and the list comes back unfiltered.
  • chat.search with a query that starts with -- throws Usage: mari chats search <query>.

Other app_data families (character.*, lorebook.*, persona.*, theme.*, preset.*, …) call storage directly and do not go through parseArgs; executeChatAction is the only action that re-enters a CLI parser.

Steps to reproduce

  1. Create a chat whose id starts with -- (for example insert a chat row with id --Ew_dash-chat-id, or create chats until nanoid produces one).
  2. Call new MariDbService(db).executeAction({ action: "chat.get", chatId: "--Ew_dash-chat-id" }).
  3. The result is { ok: false, error: "Usage: mari chats get <id>" } instead of the chat.

Environment

  • Marinara Engine version: 2.5.0 (staging at e0d33c86b, and current staging a8ce0021f)
  • Install type: source (GitHub Actions ubuntu-latest), reproduced locally
  • OS + version: Ubuntu runner in CI; macOS 26 locally
  • Browser or app shell: n/a (server-side Professor Mari app_data action)

Logs, screenshots, or video

Regression Checks run 37618203499 on staging e0d33c86b (Oct 7), job complete-node-regressions:

[scripts/regressions/mari/chat-app-data.regression.ts] stdout: WARN [mari-db] structured app_data action failed
      "message": "Usage: mari chats get <id>",
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
false !== true
    at <anonymous> (scripts/regressions/mari/chat-app-data.regression.ts:32:12)

Line 32 is assert.equal(fetched.ok, true) right after executeAction({ action: "chat.get", chatId: chat.id }), where chat.id is a fresh nanoid. The same regression passes on rerun because the next id does not start with --.

Additional context

Found during the nightly e2e/CI triage. mari db already handles ---prefixed ids through known value flags and the -- end-of-options marker (db-hyphen-ids.regression.ts); the chat bridge does not use either.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Oct 8, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7289 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Professor Mari's structured `chat.*` app_data actions cannot read a chat whose id starts with `--`. Chat ids are 21-character nanoids, so about 1 chat in 4096 starts with `--` (`1/64²`). For those chats, `chat.get` and `chat.messages` fail with `Usage: mari chats get <id>`, and `chat.list` with a character id that starts with `--` silently ignores the filter. This also makes `scripts/regressions/mari/chat-app-data.regression.ts` flaky in CI, because the fixture chat gets a fresh nanoid on every run. ## Expected behavior `chat.get`, `chat.messages`, `chat.list` (with `characterId`) and `chat.search` treat the chat id, character id, or query as a value whatever its first characters are. ## Actual behavior `executeChatAction` (`packages/server/src/services/mari-db/mari-db.service.ts`) turns the structured action back into CLI argv (`[sub, <chatId>, --flag, value]`) and hands it to `executeChatsCommand`, whose `parseArgs` (line 849) treats any argument starting with `--` as a flag. The chat id disappears from the positionals: - `chat.get` / `chat.messages` throw `Usage: mari chats get <id>` / `Usage: mari chats messages <chat-id> ...`. - `chat.list` with `characterId: "--…"` pushes `--character --…`; the value is read as another flag, `--character` becomes `true`, and the list comes back unfiltered. - `chat.search` with a query that starts with `--` throws `Usage: mari chats search <query>`. Other app_data families (`character.*`, `lorebook.*`, `persona.*`, `theme.*`, `preset.*`, …) call storage directly and do not go through `parseArgs`; `executeChatAction` is the only action that re-enters a CLI parser. ## Steps to reproduce 1. Create a chat whose id starts with `--` (for example insert a chat row with id `--Ew_dash-chat-id`, or create chats until nanoid produces one). 2. Call `new MariDbService(db).executeAction({ action: "chat.get", chatId: "--Ew_dash-chat-id" })`. 3. The result is `{ ok: false, error: "Usage: mari chats get <id>" }` instead of the chat. ## Environment - Marinara Engine version: 2.5.0 (`staging` at `e0d33c86b`, and current `staging` `a8ce0021f`) - Install type: source (GitHub Actions `ubuntu-latest`), reproduced locally - OS + version: Ubuntu runner in CI; macOS 26 locally - Browser or app shell: n/a (server-side Professor Mari app_data action) ## Logs, screenshots, or video Regression Checks run [37618203499](https://github.com/Pasta-Devs/Marinara-Engine/actions/runs/37618203499) on `staging` `e0d33c86b` (Oct 7), job `complete-node-regressions`: ``` [scripts/regressions/mari/chat-app-data.regression.ts] stdout: WARN [mari-db] structured app_data action failed "message": "Usage: mari chats get <id>", AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: false !== true at <anonymous> (scripts/regressions/mari/chat-app-data.regression.ts:32:12) ``` Line 32 is `assert.equal(fetched.ok, true)` right after `executeAction({ action: "chat.get", chatId: chat.id })`, where `chat.id` is a fresh nanoid. The same regression passes on rerun because the next id does not start with `--`. ## Additional context Found during the nightly e2e/CI triage. `mari db` already handles `--`-prefixed ids through known value flags and the `--` end-of-options marker (`db-hyphen-ids.regression.ts`); the chat bridge does not use either. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 06:09:58 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SpicyMarinara commented on GitHub (Oct 8, 2026):

Fixed on staging by #7291. Ships to main with the next promotion.

<!-- gh-comment-id:6056056686 --> @SpicyMarinara commented on GitHub (Oct 8, 2026): Fixed on `staging` by #7291. Ships to `main` with the next promotion.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4064
No description provided.