@memnexus-ai/mx-agent-cli 0.1.252 → 0.1.253

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -84,10 +84,26 @@ fi
84
84
  # we can name WHICH pattern the override cleared; refuse() then logs and allows
85
85
  # instead of blocking. A GIT_EXPERT=1 command that matches nothing is not an
86
86
  # override of anything and is not logged.
87
+ #
88
+ # LOG FIDELITY (#4804, part 1 of 2). OVERRIDE below is a WHOLE-COMMAND test and
89
+ # still governs the allow/deny decision exactly as before — this commit changes
90
+ # no boundary. What it changes is what gets WRITTEN: a record is appended only
91
+ # when the override token and the pattern that matched occur in the SAME command
92
+ # segment (SEG_OVERRIDE, set in check_segment). The whole-command test made the
93
+ # log useless as evidence — a read-only command that merely mentions both the
94
+ # token and a destructive verb somewhere in its text (an agent writing about the
95
+ # guard, a probe script being edited) produced a record indistinguishable from a
96
+ # genuine override. All four records in the live log were produced that way; none
97
+ # was a real override. Same-segment is the weakest condition that separates "the
98
+ # token was applied to this command" from "the token appears somewhere on the
99
+ # line", and it is decision-neutral, so it needs no boundary re-verification.
100
+ OVERRIDE_RE='(^|[^A-Za-z_])GIT_EXPERT=1(\s|$)'
87
101
  OVERRIDE=0
88
- if echo "$COMMAND" | grep -qE '(^|[^A-Za-z_])GIT_EXPERT=1(\s|$)'; then
102
+ if echo "$COMMAND" | grep -qE "$OVERRIDE_RE"; then
89
103
  OVERRIDE=1
90
104
  fi
105
+ # Set per segment by check_segment; consumed by refuse() for logging only.
106
+ SEG_OVERRIDE=0
91
107
 
92
108
  # --- override audit log (fail-open, side-effect only) -------------------------
93
109
  # One JSONL line per cleared block, alongside idle-gate.jsonl / session-pause.jsonl.
@@ -357,8 +373,16 @@ refuse() {
357
373
 
358
374
  # Override in effect: record what it cleared, then allow. Silent on stdout and
359
375
  # stderr — the allow contract is "exit 0, no output".
376
+ #
377
+ # The ALLOW is decided by the whole-command OVERRIDE (unchanged). The RECORD is
378
+ # written only when the token sits in the same segment as the pattern that
379
+ # matched (#4804): a command whose token and pattern are in different segments
380
+ # is still allowed exactly as before, but it is not evidence of an override and
381
+ # must not be written down as one.
360
382
  if [[ "$OVERRIDE" -eq 1 ]]; then
361
- log_override "$what"
383
+ if [[ "$SEG_OVERRIDE" -eq 1 ]]; then
384
+ log_override "$what"
385
+ fi
362
386
  exit 0
363
387
  fi
364
388
 
@@ -433,6 +457,13 @@ GITSEG='(^|[;&|({`]|\s(then|do|else)\s)\s*([0-9]*[<>][^[:space:]]*\s+|[A-Za-z_][
433
457
  check_segment() {
434
458
  local seg="$1"
435
459
 
460
+ # Does the override token appear in THIS segment (#4804)? Logging-only in this
461
+ # revision: refuse() still decides allow/deny from the whole-command OVERRIDE.
462
+ SEG_OVERRIDE=0
463
+ if printf '%s' "$seg" | grep -qE "$OVERRIDE_RE"; then
464
+ SEG_OVERRIDE=1
465
+ fi
466
+
436
467
  # git stash (mutating forms). Allow read-only `stash list` / `stash show`;
437
468
  # block bare stash, push, pop, apply, drop, clear, save, branch, create, store.
438
469
  if printf '%s' "$seg" | grep -qE "${GITSEG}stash\b"; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memnexus-ai/mx-agent-cli",
3
- "version": "0.1.252",
3
+ "version": "0.1.253",
4
4
  "description": "CLI for creating and managing AI agent teams",
5
5
  "type": "module",
6
6
  "bin": {