Commit Graph
2 Commits
Author SHA1 Message Date
yetone 21aa402856 gui tests: the Codex subagent details test writes its rollouts now, not on 2026-10-15, so main is green in UTC (#1591)
3c4b4dc97's TestCodexSubagentDetailsReachSessionAPIs held usage's clock at
2026-10-15 12:00 local and wrote the rollouts then, but
/api/sessions/overview reads sessions.StatsFor, whose 7-day window ends at
the real today. On CI (UTC, still 10-14) the fixture day was tomorrow and
the child was left out: "overview token top omitted the active Codex
child", red on macOS and ubuntu at 84f14e555 and aae49d086. In UTC+8 it
passed, and from 10-23 it would have failed everywhere. The test now holds
the clock at time.Now().

What was run, at origin/main 8d2a4a7da:
- before: TZ=UTC go test -run TestCodexSubagentDetailsReachSessionAPIs
  ./internal/gui fails as on CI; Asia/Shanghai passes.
- after: the test passes under TZ UTC, Asia/Shanghai, America/Los_Angeles
  and Pacific/Kiritimati; go test -tags nogui ./internal/gui (local TZ and
  UTC) and ./internal/sessions (UTC): ok. go vet ./internal/gui: clean.
- Siblings: no other internal/gui test holds a fixed date and reads
  /api/sessions.
Not run: the rest of ./... (test-only change in one file).
2026-10-15 05:10:28 +08:00
Hogee 3c4b4dc973 sessions, usage: a Codex subagent with no title takes its parent's spawn_agent task_name, its nickname shows apart, and Usage requests say which calls were compactions (#1591, Hogeexxl)
Hogeexxl's change (his fork branch codex/codex-session-details, f7c176c9),
cherry-picked with his authorship:

- A Codex child thread whose title is still empty after the existing
  precedence takes the task_name of the parent's spawn_agent call, linked by
  the call id and the SubAgentActivity "started" item that names the child's
  agent_thread_id. Conflicting links leave the title empty.
- session_meta.agent_nickname is exposed as `nickname` on the list, one,
  manage and overview responses, beside the title, not in place of it.
- GET /api/usage/requests and /v1/magpie/usage/requests carry `compaction`
  (true/false) for Codex calls with native evidence, and leave it out
  otherwise. A gateway row matched by a unique response_id takes the marker
  and keeps its own model, usage, cost and kind.
- Flags bits 1024 (rowCompactionKnown) and 2048 (rowCompaction) are new.
  TestRowFlagsApart covers them, and they don't overlap 1..512. The sessions
  cache goes to version 21 and the calls cache to calls-v15.

Review:
- Rollout format checked against Codex's source (openai/codex 669449b):
  - v2 spawn_agent args carry task_name.
  - A paginated rollout persists item_completed with a SubAgentActivity
    item: kind "started", id = the call id, agent_thread_id.
  - SessionMeta has a top-level agent_nickname, which Codex's own list.rs
    and metadata.rs read too.
  - compaction_response_id lives in token_usage_record.
  Gaps in legacy rollouts and in calls without a response_id are fixed in
  the next two commits.
- Privacy: only a title string the user's own Codex wrote and a boolean
  are added to local API responses. Nothing new goes to a vendor or to
  telemetry. The ingest POST parses fields one by one, so it is unchanged.
- No .github, dependency or network changes.

What was run:
- His tests pass: go test -tags nogui ./internal/sessions ./internal/usage,
  and the two new internal/gui API tests.
- Broken by hand, each caught by his tests:
  - the nickname read removed;
  - the conflict checks removed;
  - mergeCodexCompactions broken;
  - the gateway pair's setCodexCompaction removed;
  - the flag read forced to true.
- Not caught:
  - the parent check on the title link (covered by a test in the next
    commit);
  - `copy.codexCompactions = nil` in cloneCodexChunks removed. That line is
    defensive only: the shared chunks never hold the map.
- The gofmt, vet and full-suite record for the three commits is in the
  last one.
2026-10-15 04:21:31 +08:00