[GH-ISSUE #3222] [Issue]: mari parser omits some boolean flags from BOOLEAN_FLAGS, silently swallowing positionals #1732

Closed
opened 2026-10-21 05:42:07 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Magiwarriorx on GitHub (Jul 4, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3222

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Prof Mari's argument parser only treats a flag as valueless if its name is in a hardcoded BOOLEAN_FLAGS set, but 13 flags that are used purely as booleans are missing from that set. When any of them appears immediately before a non-flag token, the parser consumes that token as the flag's "value", silently discarding a required positional.

Expected behavior

mari chats messages --tail <chat-id> should list the tail of the chat's messages regardless of whether --tail comes before or after the <chat-id> positional, since --tail is a boolean flag.

Actual behavior

--tail swallows <chat-id> as its value. positionals[0] is then undefined, so the command throws its usage error (Usage: mari chats messages <chat-id> …) even though a chat id was supplied. hasFlag(flags, "tail") still returns true (the stored value isn't false), so the flag reads as "set" while having destroyed the positional.

Steps to reproduce

  1. Run any mari subcommand that takes a positional, with a missing-from-set boolean flag placed before that positional. Minimal case: mari chats messages --tail <chat-id>.
  2. Observe the command fails with the Usage: mari chats messages <chat-id> … error.
  3. Compare with mari chats messages <chat-id> --tail, which works — the only difference is flag order.

Environment

  • Marinara Engine version: 2.1.0
  • Install type: source
  • OS + version: N/A — static source review at commit a90e7158 (branch staging)
  • Browser or app shell: N/A

Logs, screenshots, or video

None

Additional context

Identified by source review; not yet reproduced against a running server.

Root cause: parseArgs treats a --flag as valueless only when its name is in BOOLEAN_FLAGS (packages/server/src/services/mari-db/mari-db.service.ts:628), otherwise it consumes the next token (:629). BOOLEAN_FLAGS (:139) lists 9 names, but hasFlag(...) is used as a pure boolean for 13 more that aren't listed: tail, global, enable, disable, constant, no-constant, changed, cached, staged, patch, full, help, no-global. None of the 13 is ever read as a value via flagString (verified across the file), so none has any reason to be excluded. The sibling parser at packages/server/src/services/mari-db/mari-images.service.ts:106 already lists help in its own BOOLEAN_FLAGS, confirming these are meant to be boolean. Nothing in the per-command usage strings, the top-level help, or the Professor Mari system prompt instructs the model to place flags after positionals, so the safe ordering is not guaranteed.

Suggested fix: add the 13 names to BOOLEAN_FLAGS at mari-db.service.ts:139. BOOLEAN_FLAGS is referenced only by parseArgs (:628), so the change is side-effect-free.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Magiwarriorx on GitHub (Jul 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3222 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Prof Mari's argument parser only treats a flag as valueless if its name is in a hardcoded `BOOLEAN_FLAGS` set, but 13 flags that are used purely as booleans are missing from that set. When any of them appears immediately before a non-flag token, the parser consumes that token as the flag's "value", silently discarding a required positional. ## Expected behavior `mari chats messages --tail <chat-id>` should list the tail of the chat's messages regardless of whether `--tail` comes before or after the `<chat-id>` positional, since `--tail` is a boolean flag. ## Actual behavior `--tail` swallows `<chat-id>` as its value. `positionals[0]` is then `undefined`, so the command throws its usage error (`Usage: mari chats messages <chat-id> …`) even though a chat id was supplied. `hasFlag(flags, "tail")` still returns `true` (the stored value isn't `false`), so the flag reads as "set" while having destroyed the positional. ## Steps to reproduce 1. Run any `mari` subcommand that takes a positional, with a missing-from-set boolean flag placed *before* that positional. Minimal case: `mari chats messages --tail <chat-id>`. 2. Observe the command fails with the `Usage: mari chats messages <chat-id> …` error. 3. Compare with `mari chats messages <chat-id> --tail`, which works — the only difference is flag order. ## Environment - Marinara Engine version: 2.1.0 - Install type: source - OS + version: N/A — static source review at commit `a90e7158` (branch `staging`) - Browser or app shell: N/A ## Logs, screenshots, or video None ## Additional context Identified by source review; **not yet reproduced against a running server**. Root cause: `parseArgs` treats a `--flag` as valueless only when its name is in `BOOLEAN_FLAGS` (`packages/server/src/services/mari-db/mari-db.service.ts:628`), otherwise it consumes the next token (`:629`). `BOOLEAN_FLAGS` (`:139`) lists 9 names, but `hasFlag(...)` is used as a pure boolean for 13 more that aren't listed: `tail`, `global`, `enable`, `disable`, `constant`, `no-constant`, `changed`, `cached`, `staged`, `patch`, `full`, `help`, `no-global`. None of the 13 is ever read as a value via `flagString` (verified across the file), so none has any reason to be excluded. The sibling parser at `packages/server/src/services/mari-db/mari-images.service.ts:106` already lists `help` in its own `BOOLEAN_FLAGS`, confirming these are meant to be boolean. Nothing in the per-command usage strings, the top-level help, or the Professor Mari system prompt instructs the model to place flags after positionals, so the safe ordering is not guaranteed. Suggested fix: add the 13 names to `BOOLEAN_FLAGS` at `mari-db.service.ts:139`. `BOOLEAN_FLAGS` is referenced only by `parseArgs` (`:628`), so the change is side-effect-free. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:42:07 +07:00
  • closed this issue
  • added the
    in-pr
    label
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#1732
No description provided.