Skip to content

Commit fc0b7fb

Browse files
committed
docs: distill codex live sessions session
1 parent ef95968 commit fc0b7fb

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

.agents/skills/gettokens-domain-engineering/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ This skill unifies the technical rules for building, styling, and debugging GetT
149149
- The frontend must support browser preview with mock snapshots, while desktop mode polls the real Wails snapshot. Show source state such as `live`, `cache`, or `preview` so stale sidecar state is not mistaken for no sessions.
150150
- Request timing trend charts must be driven by request records, not decorative UI state. Put trend derivation in a pure model under `features/codex-live-sessions/model/`, merge the active request by `requestID`, sort points by `startedAt`, and accept an explicit `nowMs` option so live requests can be projected in tests.
151151
- For streaming / active / reconnecting requests without `completedAt`, project `totalDurationMs` from `nowMs - startedAt` with a bounded safety cap. Do not mutate the original request or invent first-event / first-token timings.
152+
- Only the current active request is allowed to use `nowMs - startedAt` projection in the timing trend. Historical request rows that still carry `streaming` / `reconnecting` from cache or stale sidecar state must keep their recorded `timing.totalDurationMs` or `completedAt - startedAt`; otherwise every total-duration point will grow together.
152153
- Trend chart x positions should use request timestamps (`startedAtMs` within min/max), not array index spacing. This keeps sparse request bursts and live samples faithful to real time.
153154
- Keep the live-session chart visually inside the page section, not as a nested card. Use the existing Swiss-industrial chart tokens, footer summaries below the graph, and live markers such as dashed strokes/rings for in-flight samples.
154155
- Browser preview data for timing charts must include multiple completed requests plus one in-flight request, so `#frame=codex&workspace=live-sessions` exercises curve shape, latest sample footer, and live marker behavior without a Wails runtime.

docs-linhay/dev/20260523-session-distillation-codex-live-sessions-ui.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ Live sessions 的 detail 面板和筛选区本质上是工作台容器,不是
7070

7171
这条边界适合继续放在 `gettokens-domain-engineering` 的 live sessions 小节里,不上升到 `AGENTS.md`
7272

73+
### 7. 请求耗时趋势只投影当前 active request
74+
75+
请求耗时趋势图的数据应从请求记录推导,不能让视觉刷新本身成为数据来源。
76+
77+
稳定边界:
78+
79+
1. 已完成请求优先使用 `timing.totalDurationMs`;缺失时才回退到 `completedAt - startedAt`
80+
2. 当前 active request 可以用 `nowMs - startedAt` 做实时投影,用于显示正在增长的 live 样本。
81+
3. 历史请求即使因为 cache 或 sidecar 残留仍带着 `streaming/reconnecting` 且没有 `completedAt`,也不能继续按 `nowMs` 投影;否则图上所有总耗时点会一起增长。
82+
4. 回归测试必须覆盖“stale streaming request + active request”并存时,只有 active request 增长。
83+
84+
这类问题不要先调 CSS 或动画。先检查纯模型输出:`points[].values.totalDurationMs``points[].isLive` 是否已经错误增长;如果模型输出错,修模型,不修图表。
85+
7386
## 不纳入
7487

7588
- 不新增独立 `gettokens-codex-live-sessions` skill;当前规则继续归入 `gettokens-domain-engineering` 的 Codex Live Sessions 小节。
@@ -88,5 +101,6 @@ Live sessions 的 detail 面板和筛选区本质上是工作台容器,不是
88101

89102
- `node --test frontend/src/features/codex-live-sessions/model.test.mjs`
90103
- `npm --prefix frontend run typecheck`
104+
- `npm --prefix frontend run build`
91105

92106
Go focused test 曾被当前工作区其他变更阻塞过:`internal/accounts/auth_file_normalize.go` 缺少 `convertSessionLikePayloadToCPA`。后续提交 live sessions 改动时,应重新确认当前工作区是否已经恢复可编译。

docs-linhay/memory/2026-05-26.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,20 @@
8484
- 修复:`internal/sidecar/isPortFree` 改为按 sidecar 实际 `host: ""` 绑定语义探测 `:<port>`;App 启动时清理同 profile `config.yaml` 的孤儿 `cli-proxy-api`,退出时 interrupt 后等待,超时 force kill。
8585
- 沉淀:更新 `gettokens-ops-governance``Sidecar Process Binding` 规则,并补充 `docs-linhay/dev/20260519-macos-runtime-residency-session-distillation.md`;不升级 `AGENTS.md`,因为这是 GetTokens Wails/macOS 生命周期细则。
8686
- 验证:`go test ./internal/sidecar ./internal/wailsapp -run 'TestPortAvailabilityMatchesWildcardSidecarBind|TestFindOrphanedSidecarPIDsMatchesSameConfigOnly|TestStopProcessKillsWhenInterruptIsIgnored|TestGetCodexLiveSessionsSnapshot' -count=1` 通过;重新拉起当前 App 后,8317 由新 App 子进程持有,live snapshot 已返回 `projectName`,样本包含 `GetTokens``design`
87+
88+
## CLIProxyAPI 上游同步
89+
- 完成:`docs-linhay/references/CLIProxyAPI#gettokens/sidecar` 已合并 `upstream/main@167edfec`,生成并推送 merge commit `b72ac277``AxApp/CLIProxyAPI#gettokens/sidecar`
90+
- 冲突:只在 `sdk/api/handlers/openai/openai_responses_websocket.go` 发生冲突;处理时保留上游 file-backed websocket timeline,同时保留 GetTokens live-session hook、pinned auth failover、wrapped status code 提取和 `coreauth.AuthAllowsWebsockets(auth)` 默认能力边界。
91+
- 验证:fork 内 `go test ./sdk/api/handlers/openai`、受影响包测试、`go test ./...``git diff --check` 均通过;父仓库 `./scripts/ensure-sidecar.sh darwin arm64` 已重建本地 sidecar,meta 记录 `commit=b72ac277``dirty=clean`
92+
- 归档:同步记录追加到 `docs-linhay/dev/20260519-cliproxyapi-upstream-sync-session-distillation.md`;本次仍属于既有 CLIProxyAPI fork 同步流程,不升级 `AGENTS.md`
93+
94+
## CLIProxyAPI 内存剪裁
95+
- 决策:live sessions tracker 只保留最近 50 条 request,保留 30 分钟窗口但增加 `DELETE /v0/management/gettokens/live-sessions` 清理接口,避免单个长会话无限堆 request。
96+
- 决策:legacy `internal/usage/logger_plugin.go` 不再把 request detail 长驻内存,改为聚合常驻、明细落盘分页读取;`usage-observed` 迁移到 `usage-observed-v2.sqlite`,不再回灌旧的大 JSON payload。
97+
- 新增:usage attribution 增加 `GET /v0/management/gettokens/usage-attribution/details`,支持 `window / limit / offset / account_key / attribution_key`,给后续前端或调试页按页取明细。
98+
- 验证:`go test ./internal/usage ./internal/gettokenshooks` 通过;这轮剪裁是为了降低 sidecar RSS,不是前端展示优化,因此没有改前端 dev server 的职责边界。
99+
100+
## Codex live sessions 请求趋势整理
101+
- 沉淀:请求耗时趋势图只允许当前 active request 使用 `nowMs - startedAt` 投影;历史请求保留记录值或完成时间差,避免 stale `streaming/reconnecting` 样本一起增长。
102+
- 已更新:`.agents/skills/gettokens-domain-engineering/SKILL.md` 的 Codex Live Sessions 小节、`docs-linhay/dev/20260523-session-distillation-codex-live-sessions-ui.md`
103+
- 不升级:该规则属于 Codex runtime observability 领域建模边界,不是 repo-wide `AGENTS.md` 约束。

0 commit comments

Comments
 (0)