From 5cf1d3846ae4458160fe0ef7ae162e369b5e2574 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 18 Nov 2026 20:06:35 +0800 Subject: [PATCH] =?UTF-8?q?sessions:=20an=20agent=20left=20off=20in=20the?= =?UTF-8?q?=20first=20"allow=20selected"=20is=20asked=20about=20once=20mor?= =?UTF-8?q?e,=20on=20Sessions=20and=20Usage=20=E2=80=BA=20Requests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit baysonfox on X: with magpie installed after Antigravity 2.0, the app's sessions and calls made without magpie never showed in Usage, while agy CLI's did. The first consent named the app off beside agy, and a named agent was never "new" again, so nothing asked about it and nothing on Usage said why. The reader is fine: the app's calls come from its own SQLite steps (antigravityRead), read once allowed. Nothing is turned on by magpie: the gate is the user's privacy choice. Instead: - settings.SessionReads gets Kept: agents turned off on their own (a sessions/reads post without `all`: Keep off, a Settings › Privacy row, `magpie sessions read off `). A post setting it on takes it out. - readsNow's New: off, found here and not Kept (was: never named). So an agent left off in the first choice's list is asked about once more, as one found later already was. - Usage › Requests shows a line above its rows for those agents (readsLater in the usage plugin): Count {names} / Don't count, the same {agents} posts as the Sessions page's laterCard. Gone after either answer; sessions/reads read at most once a minute. - Old data: an agent turned off in Settings before Kept existed has no entry and is asked once more, for every user with such an agent. Tests: - TestSessionReadsUncheckedAgentAskedAgain (count, keep off): sandbox HOME with testdata/agy-sessions and the real Antigravity 2.30 conversation (antigravity-2.30-tools); after the first choice the app is off and New, has no rows in /api/usage/requests; Count brings its rows in, Keep off keeps none, and neither is asked again. Red on the old code (New false after the first choice). - TestSessionReadsTurnedOffNotAskedAgain: off on its own, under all true and all false, is neither on nor New. - usage-reads-note.test.cjs: the Requests line in Chromium and WebKit, en/zh/zh-TW/ja/de at 900/420/390px, both answers, buttons inside the line, no sideways scroll; red on the old code (no #ledReads). Run on mica (mote was full: load 40+, another GUI suite on it), rebased on 389169f76: - gofmt -l clean - go vet on gui, sessions, settings, cli and tui; GOOS=linux -tags nogui and GOOS=windows vet on gui, sessions, settings and cli; go build ./... - go test -count=1 -timeout 45m on internal/gui, sessions, settings, cli and tui: all ok except gui's TestGatewayModeListsNoOwnSessions, red the same on an untouched 389169f76 copy (#7064) - GUI, both engines: usage-reads-note, sessions-reads, i18n-keys, i18n-en-no-cjk, usage-ledger, usage-request-page, usage-no-reading, usage-ledger-fit, ledger-hscroll, usage-phone-head, sessions-usage-off. Only usage-ledger's "newest live route needs no return-to-live button" was red (en, zh, both engines), red the same on the untouched 389169f76 copy (#3104). i18n-keys first caught "Leave off" as otel's word; renamed to "Don't count". - After rebasing on dc507aefd: gofmt, vet, the TestSessionReads tests and usage-reads-note, i18n-keys, i18n-en-no-cjk and sessions-reads again: all ok, 98 of 98 GUI tests. Broken by hand: recording Kept on every off post (all sent too) turns TestSessionReadsNewAgent, ...UncheckedAgentAskedAgain and ...TurnedOffNotAskedAgain red. Not tried: the whole GUI suite (both machines had another GUI suite running), the full go test ./..., and a real Antigravity 2.0 install in the GUI; the live Antigravity data was not touched. --- docs/subsystems/gateway-sessions.md | 19 ++- internal/gui/assets/app.css | 4 + internal/gui/assets/plugins/usage/client.js | 1 + internal/gui/assets/plugins/usage/i18n.js | 8 ++ internal/gui/assets/plugins/usage/page.js | 52 +++++++ internal/gui/sessions_reads.go | 13 +- internal/gui/sessions_reads_unchecked_test.go | 129 ++++++++++++++++++ internal/gui/tests/usage-reads-note.test.cjs | 58 +++++++- internal/sessions/access.go | 21 +++ internal/settings/settings.go | 5 + 10 files changed, 297 insertions(+), 13 deletions(-) create mode 100644 internal/gui/sessions_reads_unchecked_test.go diff --git a/docs/subsystems/gateway-sessions.md b/docs/subsystems/gateway-sessions.md index 8f99a22a5..a3a1e6519 100644 --- a/docs/subsystems/gateway-sessions.md +++ b/docs/subsystems/gateway-sessions.md @@ -441,11 +441,20 @@ covers them), and `sessions/manage` carries the same as `reads`. While `asked` is false the Sessions page shows the consent (`consentCard` in the sessions plugin): each agent found with a switch, off; Allow selected saves `all: false` with each agent picked or not, Allow all `all: true`. -A choice with `all` false reads no agent it doesn't name, so one found -after it (Antigravity 2.0 installed after Allow selected: baysonfox on -X) is `new` in `found` (on disk, not named, not read), and the Sessions -page asks about those once (`laterCard`): Show their sessions sends -each `true`, Keep off `false`, so it isn't new again. +A choice with `all` false reads no agent it doesn't name. An agent off +and found here is `new` in `found` unless it was turned off on its own: +a post without `all` that sets it `false` (Keep off, a Settings › +Privacy row, `magpie sessions read off `) records it in +`sessionReads.kept`, and one that sets it `true` takes it out. So an +agent found after the first choice, and one left off in that choice's +list (Antigravity 2.0 beside agy CLI: baysonfox on X, whose app calls +made without magpie were counted nowhere), are asked about once more: +on the Sessions page (`laterCard`: Show their sessions sends each +`true`, Keep off `false`) and above Usage › Requests' rows (`readsLater` +in the usage plugin's `page.js`: Count / Don't count, the same posts). +An agent turned off in Settings before `kept` existed has no entry and +is asked once (`TestSessionReadsUncheckedAgentAskedAgain`, +`TestSessionReadsTurnedOffNotAskedAgain`). Settings › Privacy, *Agents' session history* (`renderSessionReads` in the sessions plugin's `settings.js`), has *Agents found later* (`all`, sent with each listed agent at the value its row shows) and a row per agent. diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index c3626bf2e..3b4fea96f 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -1805,6 +1805,10 @@ body.masked :hover > .acct-eye, body.masked .pq-card:hover .acct-eye, body.maske .led-hscroll::-webkit-scrollbar-button, .led-hscroll::-webkit-scrollbar-corner { display: none; } .reads-note { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; } .reads-note p { margin: 0; } +.reads-later { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 9px; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; } +.reads-later[hidden] { display: none; } +.reads-later p { margin: 0; flex: 1 1 260px; min-width: 0; color: var(--muted); line-height: 1.45; } +.reads-later-acts { display: flex; gap: 4px; margin-left: auto; } .led-none { padding: 18px 16px; color: var(--muted); text-align: center; line-height: 1.5; } .led-sk { padding: 11px 14px; } .led-sk + .led-sk { border-top: 1px solid var(--line-2); } diff --git a/internal/gui/assets/plugins/usage/client.js b/internal/gui/assets/plugins/usage/client.js index e68b0eeaa..e36fe88dd 100644 --- a/internal/gui/assets/plugins/usage/client.js +++ b/internal/gui/assets/plugins/usage/client.js @@ -76,6 +76,7 @@ magpie.plugin("usage", (ctx) => {

Gateway and session-log calls; local rejections excluded from totals.

+