yetone
b4d1c393c1
redact: a Chinese session's words before a missing module are read as cheaply ( #4766 )
...
The #4766 fix read the last 64 bytes before the quote, but fell back to
lowering the whole text before it when those bytes were not ASCII. A
session written in Chinese is not ASCII, so it kept the quadratic cost
the fix removed. Lowering is rune by rune with no context, so the last
bytes of the lowered window equal the last bytes of the lowered whole
text; the fallback is dropped. The spaces before the quote are now
trimmed before the window is taken, so more than 64 of them no longer
hide the words.
Run (mote-run, -tags nogui):
- go test ./internal/redact: ok.
- With ggbdpq's model.go: the new Chinese case is red (450560 bytes made,
8 KiB at most). With main's: red (401408 bytes). With the window taken
before the trim: the many-spaces case is red.
2026-11-01 22:23:51 +08:00
..
2026-10-27 14:10:33 +08:00
2026-10-22 04:07:55 +08:00
2026-10-22 10:52:04 +08:00
2026-10-29 01:17:04 +08:00
2026-10-25 03:53:35 +08:00
2026-10-27 22:44:52 +08:00
2026-10-29 01:17:04 +08:00
2026-10-25 16:47:29 +08:00
2026-10-13 14:14:59 +08:00
2026-10-28 16:05:19 +08:00
2026-10-27 17:10:20 +08:00
2026-10-29 01:17:04 +08:00
2026-10-31 14:19:02 +08:00
2026-10-27 14:10:33 +08:00
2026-10-31 11:23:53 +08:00
2026-10-28 15:16:59 +08:00
2026-10-29 00:45:18 +08:00
2026-10-21 19:38:31 +08:00
2026-10-26 15:06:01 +08:00
2026-10-24 21:00:05 +08:00
2026-10-21 06:12:37 +08:00
2026-10-28 16:05:19 +08:00
2026-10-28 16:05:19 +08:00
2026-11-01 06:38:01 +08:00
2026-10-09 11:56:10 +08:00
2026-10-30 10:26:50 +08:00
2026-11-01 15:51:18 +08:00
2026-10-04 23:30:56 +08:00
2026-10-28 17:36:40 +08:00
2026-11-01 22:23:51 +08:00
2026-10-26 22:16:02 +08:00
2026-10-21 19:13:49 +08:00
2026-10-31 11:48:21 +08:00
2026-10-29 00:45:18 +08:00
2026-11-01 22:23:51 +08:00
2026-10-29 00:45:18 +08:00
2026-10-29 08:45:58 +08:00
2026-10-28 16:05:19 +08:00
2026-10-28 16:05:19 +08:00
2026-10-29 09:20:38 +08:00
2026-10-24 19:41:02 +08:00
2026-11-01 06:38:01 +08:00
2026-11-01 09:44:31 +08:00
2026-10-31 11:23:53 +08:00
2026-10-15 23:08:05 +08:00
2026-11-01 09:44:31 +08:00
2026-11-01 09:44:31 +08:00
2026-11-01 06:38:01 +08:00
2026-10-22 04:07:55 +08:00
2026-10-28 16:05:19 +08:00
2026-10-18 02:49:19 +08:00
gateway: a request archive, off unless turned on, keeps each call's headers and bodies in the user's own S3 bucket and a recent call reads its own back (Jorben on Discord: 请求存档) — the Gateway page's recent calls only ever held the last bodies in memory, the first 256 KB of each, with no headers, gone at a restart. A switch over Recent calls ("Request archive", POST /api/settings/archive, settings' requestArchive) turns it on, refused with a reason while sync isn't set up with an s3:// bucket; with it on, each call the gateway serves gets an id (UTC HHMMSS-<16 hex>, said back in X-Magpie-Archive-Id) and, once it is recorded, its method, path and query, request headers and body and response status, headers and body go as one JSON file to <prefix>/magpie/archive/<YYYY-MM-DD>/<id>.json in the bucket sync keeps its backup in, signed with the same client (davsync.Bucket, no new SDK). Before anything leaves, Authorization, x-api-key, Cookie, Set-Cookie, any header or JSON field or query parameter named for a key, token, secret or password, and anything that looks like a key or token anywhere in the text (the redaction rules' patterns, in a stream's data lines too) become [REDACTED] — gone, no placeholder kept; the archive is plain JSON, readable in the bucket, not sealed with the passphrase. Uploads go one at a time on their own goroutine from a queue of 16 calls, each body capped at the 256 KB the call already keeps and marked truncated; a full queue drops the call with a log line, a failed upload is logged and shown under the switch until the next one goes, and no request waits on any of it. A recent call the archive kept shows its date and id under its bodies, and "Fetch from archive" (GET /api/archive?date=&id=, only a date and an id of that shape) shows the request's and response's headers and bodies as the bucket has them, or says it isn't there yet. The hook is in record() and the Call literal, so PR #239 's request log lines are not touched; the archived call carries its usage, and with #239 its vendor request id. Only calls through serve() are archived, not Codex's backend, image or video calls. TestArchiveOn, TestArchiveOff, TestArchiveName, TestRequestArchiveToS3 (a real gateway request through the signature-checking fake S3), TestScrub and request-archive.test.cjs fail without the change; TestSettingsSaveKeepsWhatItDoesNotSend now sets requestArchive. A sandbox magpie web with a fake vendor and a fake S3 server uploaded nothing while off; on, it uploaded a signed archive with none of eight planted secrets in it, read it back through /api/archive and in the page, and with the S3 server down served the call in 0.1 s and said why the upload failed. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (Claude account tests and TestClaudeRunEndsWhenTheClientLeaves pass alone); request-archive, click-scroll, old-webkit, sse-body, gateway-fold pass.
2026-10-01 17:13:34 +08:00
2026-11-01 06:38:00 +08:00
2026-10-23 20:53:53 +08:00
2026-10-25 16:16:27 +08:00
2026-10-31 11:48:21 +08:00
2026-10-28 11:23:46 +08:00
2026-10-31 11:48:21 +08:00
2026-10-28 16:05:19 +08:00
2026-10-28 17:23:59 +08:00
2026-10-31 14:19:02 +08:00
2026-10-29 15:53:04 +08:00
2026-10-25 09:57:21 +08:00
2026-10-25 16:48:07 +08:00
2026-10-27 15:34:38 +08:00
2026-10-31 11:23:53 +08:00
2026-10-28 17:01:49 +08:00
2026-10-28 17:01:49 +08:00
2026-10-29 01:17:04 +08:00
2026-10-25 16:55:06 +08:00