wechatbridge-cli 1.7.4__tar.gz → 1.9.0__tar.gz

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.
Files changed (29) hide show
  1. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/PKG-INFO +13 -7
  2. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/README.md +12 -6
  3. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/tests/test_codex.py +28 -8
  4. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/tests/test_dsh.py +3 -0
  5. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/tests/test_hardening.py +1272 -5
  6. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/__init__.py +1 -1
  7. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/agy.py +183 -48
  8. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/codex.py +77 -96
  9. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/config.py +14 -2
  10. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/dsh.py +55 -49
  11. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/grok.py +58 -10
  12. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/main.py +319 -46
  13. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/price.py +22 -1
  14. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/runner_common.py +362 -20
  15. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge_cli.egg-info/PKG-INFO +13 -7
  16. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/LICENSE +0 -0
  17. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/pyproject.toml +0 -0
  18. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/setup.cfg +0 -0
  19. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/tests/test_codex_auth.py +0 -0
  20. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/tests/test_grok_auth.py +0 -0
  21. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/tests/test_price.py +0 -0
  22. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/__main__.py +0 -0
  23. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/ilink.py +0 -0
  24. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge/update_check.py +0 -0
  25. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge_cli.egg-info/SOURCES.txt +0 -0
  26. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge_cli.egg-info/dependency_links.txt +0 -0
  27. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge_cli.egg-info/entry_points.txt +0 -0
  28. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge_cli.egg-info/requires.txt +0 -0
  29. {wechatbridge_cli-1.7.4 → wechatbridge_cli-1.9.0}/wechatbridge_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wechatbridge-cli
3
- Version: 1.7.4
3
+ Version: 1.9.0
4
4
  Summary: Bridge WeChat messages to agy, Grok Build, or Codex CLIs — text/image/file/voice in, CLI replies and generated files back.
5
5
  Author: WeChatBridge contributors
6
6
  License: MIT
@@ -54,7 +54,7 @@ The bridge process stays up and long-polls iLink. For prompts that go to a CLI,
54
54
  - Runtime backend switch: `/backend agy`, `/backend grok`, `/backend codex`, or `/backend dsh` (clears that backend's continuation state — the agy/grok continuation flag and the codex `thread_id`/resume state — so the next CLI turn starts a fresh session; history files on disk are not wiped immediately)
55
55
  - Slash commands for model, session reset, persona, and more (see below)
56
56
  - Dangerous-prompt gate: a **keyword list** of concrete destructive patterns asks for confirmation before run
57
- - Sender whitelist (`WECHATBRIDGE_ALLOWED_SENDERS`; empty = allow all)
57
+ - Sender whitelist (`WECHATBRIDGE_ALLOWED_SENDERS`; non-empty = listed users only, `*` = allow all; empty = admins only, deny all when no admins)
58
58
  - `/mcp` returns short usage text; `/agent` rewrites into a natural-language subagent prompt for the CLI (not a native MCP bridge)
59
59
  - Media over WeChat CDN with AES-128-ECB encrypt/decrypt
60
60
  - Multi-instance: one codebase, set `WECHATBRIDGE_INSTANCE` per process (state / session / QR paths derive from it)
@@ -191,11 +191,14 @@ Key variables (all have defaults):
191
191
  | `WECHATBRIDGE_DSH_STATE_DIR` | _derived_ | bridge-private dsh state directory (memory JSONL and persistent session IDs; defaults to `~/.local/share/wechatbridge/<instance>/dsh_state`) |
192
192
  | `WECHATBRIDGE_BACKEND` | `agy` | global default backend (`agy` / `grok` / `codex` / `dsh`; overridable per user via `/backend`) |
193
193
  | `WECHATBRIDGE_INSTANCE` | `default` | instance name; state / session / QR paths derive from it |
194
- | `WECHATBRIDGE_ALLOWED_SENDERS` | _empty_ | comma-separated WeChat IDs (empty = allow all) |
194
+ | `WECHATBRIDGE_ALLOWED_SENDERS` | _empty_ | comma-separated WeChat IDs; `*` = allow all; empty = only `WECHATBRIDGE_ADMINS` users (deny all if that is empty too) |
195
195
  | `AGY_TIMEOUT` | `600` | CLI run timeout in seconds (agy / grok / codex backends) |
196
196
  | `WECHATBRIDGE_MAX_OUTBOUND_BYTES` | `104857600` | max file size sent back to WeChat (100 MB) |
197
197
  | `WECHATBRIDGE_MAX_INBOUND_BYTES` | `20971520` | max inbound image/file after download (20 MB) |
198
198
  | `WECHATBRIDGE_MAX_CONCURRENT` | `4` | global concurrent process slots; same user serial (queue does not hold a slot); extras get a busy reply (on small RAM hosts, lower this to avoid concurrent CLI memory spikes; see [Memory limits](#memory-limits)) |
199
+ | `WECHATBRIDGE_QUEUE_NOTICE` | `true` | one-shot "queued" notice when the user's previous message is still running; set `0`/`false`/`no` to disable |
200
+ | `WECHATBRIDGE_PROGRESS_NOTICE` | `true` | one-shot "still working" notice after a message runs past `WECHATBRIDGE_PROGRESS_NOTICE_DELAY`; set `0`/`false`/`no` to disable |
201
+ | `WECHATBRIDGE_PROGRESS_NOTICE_DELAY` | `30` | seconds before the progress notice fires |
199
202
  | `WECHATBRIDGE_CONFIRM_TOKEN` | `y` | reply this token to approve a gated dangerous prompt |
200
203
  | `WECHATBRIDGE_ENABLE_MCP` | `true` | enable the `/mcp` help text command |
201
204
  | `WECHATBRIDGE_ENABLE_SUBAGENT` | `true` | enable the `/agent` prompt-rewrite command |
@@ -234,6 +237,8 @@ Data lives under `~/.local/share/wechatbridge/<instance>/` (sessions, SQLite his
234
237
 
235
238
  Before upgrading a **major** or **minor** version (e.g. 1.2 → 1.3), check the corresponding section in [`CHANGELOG.md`](CHANGELOG.md) for breaking changes and migration steps.
236
239
 
240
+ > **Before upgrading to 1.8.0:** configure `WECHATBRIDGE_ADMINS` or `WECHATBRIDGE_ALLOWED_SENDERS` in your `.env` — since 1.8.0 the whitelist denies everyone when both are empty (set `WECHATBRIDGE_ALLOWED_SENDERS=*` to keep allowing all users).
241
+
237
242
  ## Deploy
238
243
 
239
244
  ### Linux (systemd)
@@ -315,11 +320,12 @@ See [`deploy/wechatbridge-windows.md`](deploy/wechatbridge-windows.md).
315
320
  | `/clear` or `/new` | start a new conversation (agy/grok: drops continue flag; codex: clears thread ID; dsh: clears window memory or persistent session ID) |
316
321
  | `/model <name>` | set model (all backends validate against a live list: agy/grok via CLI `models`; codex via `codex debug models` [then `--bundled`]; unknown name or list-fetch failure refuse and do not write prefs; see `/models`) |
317
322
  | `/models` | list models — agy/grok/codex all query the live CLI (codex: `debug models`; falls back to a built-in reference note only if the live list cannot be fetched) |
318
- | `/fast` | set low reasoning effort (**on only** — not a toggle; no “off” command) |
319
- | `/planning` | set planning mode (**on only** — not a toggle) |
320
- | `/add-dir <path>` | **agy:** pass `--add-dir` on later runs if path is allowed. **grok:** recorded only; not passed to the CLI yet |
323
+ | `/fast` | fast-mode toggle: low reasoning effort (accepts `on`/`off`; a second bare `/fast` turns it off) |
324
+ | `/planning` | planning-mode toggle (accepts `on`/`off`; a second bare `/planning` turns it off) |
325
+ | `/add-dir <path>` | **agy/codex:** pass `--add-dir` on later runs if path is allowed. **grok:** recorded only; not passed to the CLI yet. No-arg shows the current list, `/add-dir clear` empties it (dsh unsupported) |
321
326
  | `/agents` | list agents via the active CLI |
322
327
  | `/persona <text>` | set persona (`show` / `clear` / `reset` subcommands) |
328
+ | `/price <link/token/keyword>` | JD/Taobao coupon & price lookup (requires `JDUNION_*` or `DATAOKE_*` keys) |
323
329
  | `/version` | show current version, instance name, and backend; if a newer version is available, show upgrade hint |
324
330
  | `/mcp` | short MCP **usage hint** text (can disable with `WECHATBRIDGE_ENABLE_MCP`) |
325
331
  | `/agent <name> <task>` | craft a "invoke subagent …" prompt and run the CLI (can disable with `WECHATBRIDGE_ENABLE_SUBAGENT`) |
@@ -330,7 +336,7 @@ Other `/…` commands are either rejected (e.g. `/exit`), reported as unsupporte
330
336
 
331
337
  ## Ops & security (what the bridge actually enforces)
332
338
 
333
- - **Whitelist first.** Empty `WECHATBRIDGE_ALLOWED_SENDERS` means anyone who can message the bot can use it.
339
+ - **Whitelist first.** Empty `WECHATBRIDGE_ALLOWED_SENDERS` means only `WECHATBRIDGE_ADMINS` members can use the bridge (everyone when the list is `*`, no one when both are empty).
334
340
  - **Auto-approve CLIs.** agy runs with `--dangerously-skip-permissions`; grok with `--always-approve` (unless planning mode); dsh tools run without host path restrictions. Treat this as trusted-user tooling, not a multi-tenant sandbox.
335
341
  - **Danger gate is keyword-based**, not full intent understanding. Defaults target concrete patterns (`rm -rf /`, pipe-to-shell, `mkfs`, `format c:`, a few heavy Chinese phrases, …). Everyday wording like bare “delete” is **not** gated. Override list via `WECHATBRIDGE_CONFIRM_KEYWORDS`; approve with `WECHATBRIDGE_CONFIRM_TOKEN` (default `y`), TTL `WECHATBRIDGE_PENDING_TTL`.
336
342
  - **Inbound media** is size-capped (default 20 MB), streamed, and CDN hosts are allowlisted. Missing `aes_key` returns a clear error.
@@ -22,7 +22,7 @@ The bridge process stays up and long-polls iLink. For prompts that go to a CLI,
22
22
  - Runtime backend switch: `/backend agy`, `/backend grok`, `/backend codex`, or `/backend dsh` (clears that backend's continuation state — the agy/grok continuation flag and the codex `thread_id`/resume state — so the next CLI turn starts a fresh session; history files on disk are not wiped immediately)
23
23
  - Slash commands for model, session reset, persona, and more (see below)
24
24
  - Dangerous-prompt gate: a **keyword list** of concrete destructive patterns asks for confirmation before run
25
- - Sender whitelist (`WECHATBRIDGE_ALLOWED_SENDERS`; empty = allow all)
25
+ - Sender whitelist (`WECHATBRIDGE_ALLOWED_SENDERS`; non-empty = listed users only, `*` = allow all; empty = admins only, deny all when no admins)
26
26
  - `/mcp` returns short usage text; `/agent` rewrites into a natural-language subagent prompt for the CLI (not a native MCP bridge)
27
27
  - Media over WeChat CDN with AES-128-ECB encrypt/decrypt
28
28
  - Multi-instance: one codebase, set `WECHATBRIDGE_INSTANCE` per process (state / session / QR paths derive from it)
@@ -159,11 +159,14 @@ Key variables (all have defaults):
159
159
  | `WECHATBRIDGE_DSH_STATE_DIR` | _derived_ | bridge-private dsh state directory (memory JSONL and persistent session IDs; defaults to `~/.local/share/wechatbridge/<instance>/dsh_state`) |
160
160
  | `WECHATBRIDGE_BACKEND` | `agy` | global default backend (`agy` / `grok` / `codex` / `dsh`; overridable per user via `/backend`) |
161
161
  | `WECHATBRIDGE_INSTANCE` | `default` | instance name; state / session / QR paths derive from it |
162
- | `WECHATBRIDGE_ALLOWED_SENDERS` | _empty_ | comma-separated WeChat IDs (empty = allow all) |
162
+ | `WECHATBRIDGE_ALLOWED_SENDERS` | _empty_ | comma-separated WeChat IDs; `*` = allow all; empty = only `WECHATBRIDGE_ADMINS` users (deny all if that is empty too) |
163
163
  | `AGY_TIMEOUT` | `600` | CLI run timeout in seconds (agy / grok / codex backends) |
164
164
  | `WECHATBRIDGE_MAX_OUTBOUND_BYTES` | `104857600` | max file size sent back to WeChat (100 MB) |
165
165
  | `WECHATBRIDGE_MAX_INBOUND_BYTES` | `20971520` | max inbound image/file after download (20 MB) |
166
166
  | `WECHATBRIDGE_MAX_CONCURRENT` | `4` | global concurrent process slots; same user serial (queue does not hold a slot); extras get a busy reply (on small RAM hosts, lower this to avoid concurrent CLI memory spikes; see [Memory limits](#memory-limits)) |
167
+ | `WECHATBRIDGE_QUEUE_NOTICE` | `true` | one-shot "queued" notice when the user's previous message is still running; set `0`/`false`/`no` to disable |
168
+ | `WECHATBRIDGE_PROGRESS_NOTICE` | `true` | one-shot "still working" notice after a message runs past `WECHATBRIDGE_PROGRESS_NOTICE_DELAY`; set `0`/`false`/`no` to disable |
169
+ | `WECHATBRIDGE_PROGRESS_NOTICE_DELAY` | `30` | seconds before the progress notice fires |
167
170
  | `WECHATBRIDGE_CONFIRM_TOKEN` | `y` | reply this token to approve a gated dangerous prompt |
168
171
  | `WECHATBRIDGE_ENABLE_MCP` | `true` | enable the `/mcp` help text command |
169
172
  | `WECHATBRIDGE_ENABLE_SUBAGENT` | `true` | enable the `/agent` prompt-rewrite command |
@@ -202,6 +205,8 @@ Data lives under `~/.local/share/wechatbridge/<instance>/` (sessions, SQLite his
202
205
 
203
206
  Before upgrading a **major** or **minor** version (e.g. 1.2 → 1.3), check the corresponding section in [`CHANGELOG.md`](CHANGELOG.md) for breaking changes and migration steps.
204
207
 
208
+ > **Before upgrading to 1.8.0:** configure `WECHATBRIDGE_ADMINS` or `WECHATBRIDGE_ALLOWED_SENDERS` in your `.env` — since 1.8.0 the whitelist denies everyone when both are empty (set `WECHATBRIDGE_ALLOWED_SENDERS=*` to keep allowing all users).
209
+
205
210
  ## Deploy
206
211
 
207
212
  ### Linux (systemd)
@@ -283,11 +288,12 @@ See [`deploy/wechatbridge-windows.md`](deploy/wechatbridge-windows.md).
283
288
  | `/clear` or `/new` | start a new conversation (agy/grok: drops continue flag; codex: clears thread ID; dsh: clears window memory or persistent session ID) |
284
289
  | `/model <name>` | set model (all backends validate against a live list: agy/grok via CLI `models`; codex via `codex debug models` [then `--bundled`]; unknown name or list-fetch failure refuse and do not write prefs; see `/models`) |
285
290
  | `/models` | list models — agy/grok/codex all query the live CLI (codex: `debug models`; falls back to a built-in reference note only if the live list cannot be fetched) |
286
- | `/fast` | set low reasoning effort (**on only** — not a toggle; no “off” command) |
287
- | `/planning` | set planning mode (**on only** — not a toggle) |
288
- | `/add-dir <path>` | **agy:** pass `--add-dir` on later runs if path is allowed. **grok:** recorded only; not passed to the CLI yet |
291
+ | `/fast` | fast-mode toggle: low reasoning effort (accepts `on`/`off`; a second bare `/fast` turns it off) |
292
+ | `/planning` | planning-mode toggle (accepts `on`/`off`; a second bare `/planning` turns it off) |
293
+ | `/add-dir <path>` | **agy/codex:** pass `--add-dir` on later runs if path is allowed. **grok:** recorded only; not passed to the CLI yet. No-arg shows the current list, `/add-dir clear` empties it (dsh unsupported) |
289
294
  | `/agents` | list agents via the active CLI |
290
295
  | `/persona <text>` | set persona (`show` / `clear` / `reset` subcommands) |
296
+ | `/price <link/token/keyword>` | JD/Taobao coupon & price lookup (requires `JDUNION_*` or `DATAOKE_*` keys) |
291
297
  | `/version` | show current version, instance name, and backend; if a newer version is available, show upgrade hint |
292
298
  | `/mcp` | short MCP **usage hint** text (can disable with `WECHATBRIDGE_ENABLE_MCP`) |
293
299
  | `/agent <name> <task>` | craft a "invoke subagent …" prompt and run the CLI (can disable with `WECHATBRIDGE_ENABLE_SUBAGENT`) |
@@ -298,7 +304,7 @@ Other `/…` commands are either rejected (e.g. `/exit`), reported as unsupporte
298
304
 
299
305
  ## Ops & security (what the bridge actually enforces)
300
306
 
301
- - **Whitelist first.** Empty `WECHATBRIDGE_ALLOWED_SENDERS` means anyone who can message the bot can use it.
307
+ - **Whitelist first.** Empty `WECHATBRIDGE_ALLOWED_SENDERS` means only `WECHATBRIDGE_ADMINS` members can use the bridge (everyone when the list is `*`, no one when both are empty).
302
308
  - **Auto-approve CLIs.** agy runs with `--dangerously-skip-permissions`; grok with `--always-approve` (unless planning mode); dsh tools run without host path restrictions. Treat this as trusted-user tooling, not a multi-tenant sandbox.
303
309
  - **Danger gate is keyword-based**, not full intent understanding. Defaults target concrete patterns (`rm -rf /`, pipe-to-shell, `mkfs`, `format c:`, a few heavy Chinese phrases, …). Everyday wording like bare “delete” is **not** gated. Override list via `WECHATBRIDGE_CONFIRM_KEYWORDS`; approve with `WECHATBRIDGE_CONFIRM_TOKEN` (default `y`), TTL `WECHATBRIDGE_PENDING_TTL`.
304
310
  - **Inbound media** is size-capped (default 20 MB), streamed, and CDN hosts are allowlisted. Missing `aes_key` returns a clear error.
@@ -43,14 +43,24 @@ class TestBuildCodexCommand(unittest.TestCase):
43
43
  self.assertEqual(
44
44
  cmd,
45
45
  ["codex", "exec", "--json", "--skip-git-repo-check",
46
- "--dangerously-bypass-approvals-and-sandbox", "hello"],
46
+ "--dangerously-bypass-approvals-and-sandbox", "--", "hello"],
47
47
  )
48
48
 
49
49
  def test_prompt_is_last_positional(self):
50
50
  cmd = self._cmd(prompt="a b c")
51
51
  self.assertEqual(cmd[-1], "a b c")
52
+ self.assertEqual(cmd[-2], "--")
52
53
  self.assertNotIn("resume", cmd)
53
54
 
55
+ def test_dash_prompt_after_separator(self):
56
+ # 以 '-' 开头的 prompt 必须跟在 "--" 之后,否则被 codex CLI 当选项。
57
+ cmd = self._cmd(prompt="--help")
58
+ self.assertEqual(cmd[-1], "--help")
59
+ self.assertEqual(cmd[-2], "--")
60
+ # prompt 本身就是 "--" 时也必须保留(fake_codex 只删第一个分隔符)
61
+ cmd = self._cmd(prompt="--")
62
+ self.assertEqual(cmd[-2:], ["--", "--"])
63
+
54
64
  def test_plan_mode_uses_readonly_sandbox(self):
55
65
  cmd = self._cmd(prefs={"mode": "plan"})
56
66
  self.assertIn("--sandbox", cmd)
@@ -92,9 +102,10 @@ class TestBuildCodexCommand(unittest.TestCase):
92
102
  cmd = self._cmd(first=False, thread_id="tid-123")
93
103
  self.assertIn("resume", cmd)
94
104
  self.assertIn("tid-123", cmd)
95
- # resume 是子命令,options 在前,prompt 在最后
105
+ # resume 是子命令,options 在前,"--" 分隔符之后是 prompt
96
106
  self.assertEqual(cmd[cmd.index("resume") + 1], "tid-123")
97
107
  self.assertEqual(cmd[-1], "hello")
108
+ self.assertEqual(cmd[-2], "--")
98
109
 
99
110
  def test_resume_no_yolo_skip_when_plan(self):
100
111
  cmd = self._cmd(first=False, thread_id="tid", prefs={"mode": "plan"})
@@ -1134,20 +1145,29 @@ class TestCodexRunFakeCli(unittest.IsolatedAsyncioTestCase):
1134
1145
 
1135
1146
  def test_fallback_scan_timeout(self):
1136
1147
  """When snapshot takes >2s, fallback scan returns empty."""
1137
- from wechatbridge import codex as codex_mod
1138
- original = codex_mod._snapshot_regular_files
1148
+ # Patch the shared implementation actually invoked by the post-scan
1149
+ # (runner_common.collect_session_fallback_artifacts calls its own
1150
+ # module-level _snapshot_regular_files); patching the thin codex
1151
+ # re-export would only slow the pre-run snapshot.
1152
+ from wechatbridge import runner_common as runner_common_mod
1153
+ original = runner_common_mod._snapshot_regular_files
1154
+ calls = []
1139
1155
 
1140
1156
  def slow_snapshot(roots):
1141
1157
  import time
1158
+ calls.append(list(roots))
1142
1159
  time.sleep(2.5)
1143
1160
  return {"/fake/file.txt": 1.0}
1144
1161
 
1145
- codex_mod._snapshot_regular_files = slow_snapshot
1146
- try:
1162
+ with mock.patch.object(
1163
+ runner_common_mod, "_snapshot_regular_files", slow_snapshot
1164
+ ):
1147
1165
  display, artifacts = self._run("hi", "u-scan-timeout", mode="ok")
1148
1166
  self.assertEqual(artifacts, [], "slow snapshot -> empty")
1149
- finally:
1150
- codex_mod._snapshot_regular_files = original
1167
+ self.assertIs(runner_common_mod._snapshot_regular_files, original)
1168
+ # 证明 patch 命中的是后置 fallback 扫描(pre-snapshot 走 codex 的
1169
+ # _rc_snapshot_regular_files 别名,不受影响)。
1170
+ self.assertEqual(len(calls), 1)
1151
1171
 
1152
1172
  def test_fallback_scan_not_on_failure(self):
1153
1173
  """Fallback scan must NOT run when process fails."""
@@ -411,6 +411,9 @@ class _DshIntegrationBase:
411
411
  p4.start(); self._patchers.append(p4)
412
412
  p_ck = mock.patch.object(config, "confirm_keywords", [])
413
413
  p_ck.start(); self._patchers.append(p_ck)
414
+ # fail-closed 白名单下,集成用例走 process_message 需显式放开
415
+ p_as = mock.patch.object(config, "allowed_senders", ["*"])
416
+ p_as.start(); self._patchers.append(p_as)
414
417
  p_env = mock.patch.dict(os.environ, {"WECHATBRIDGE_CONFIRM_KEYWORDS": ""}, clear=False)
415
418
  p_env.start(); self._patchers.append(p_env)
416
419