fix(global-discover): bucket codex sessions by originator - #1488
fix(global-discover): bucket codex sessions by originator#14880xDevNinja wants to merge 1 commit into
Conversation
|
Heads-up that this PR is now stale against main. The Problem 2 fix landed independently via #1592 / v1.41.1.0 on 2026-05-20: main's The two implementations make different trade-offs rather than one being a strict superset:
That said, main is the one that's merged, has regression tests, and chose the 64KB / 30-line / drop-partial mix deliberately. Keeping this PR's Problem 2 patch would mean re-arguing those defaults from scratch. The unique remaining value here is Problem 1 — bucketing Codex sessions by Suggestion: rebase onto main, drop the
Happy to open a follow-up PR with just the originator half if that helps — no rush from my side, just flagging since the PR has been quiet for ~16 days. |
Codex rollouts carry a free-form payload.originator string but global discovery collapsed every codex session into one number, so /retro global could not tell real interactive dev (Codex Desktop) from subagent / scripted runs (codex_exec) or CC-driven calls (Claude Code). Add a four-bucket classifier (desktop / exec / claude_code / other). Unknown, missing, null, and non-string originators land in other rather than being dropped, so the per-bucket counts always sum to the codex total. Whitespace is trimmed before matching. Buckets surface in both the JSON output (tools.codex.originators + per-repo codex_originators) and the summary view. Refs garrytan#1315.
69a2b46 to
b729817
Compare
|
Rebased onto current main and narrowed the scope to just the codex-originator bucketing, per @Akagilnc's review. Dropped (now redundant): the Kept (unique, missing on main — Picked up both follow-ups you flagged:
Buckets are additive (existing totals unchanged) and always sum to the codex total. 35 tests pass. |
|
Thanks for the rebase and for picking up both follow-ups — the Three small housekeeping suggestions, all non-blocking and entirely up to you and the maintainers:
Either way, the bucketing work here looks good to me. Thanks for sticking with it. |
|
good catches, both real. updated the description: scope is originator-only now, 35 tests, and swapped agreed on the third one too. i'll drop a note on #1315 pointing at #1592 for problem 2 and open a separate issue for the /retro global annotation, that's a retro-template change and doesn't belong here. |
|
Thanks for following through on this. Really appreciate the cleanup and for linking everything back together — much easier to follow now. |
|
@16francej Merge this version because it correctly buckets Codex sessions by originator and passed the Mac checks. |
Summary
Buckets codex sessions by
payload.originator.scanCodexnormalizes it into{ desktop, exec, claude_code, other }and surfaces the breakdown attools.codex.originators(global) andcodex_originators(per-repo), plus the summary view. Existingcodextotals are untouched — the change is purely additive, so no consumer breaks.Unknown, missing, null, and non-string originators land in
otherrather than being dropped, so the buckets always sum to the codex total. Whitespace is trimmed before matching.Refs #1315— this covers Problem 1 only. See scope note below.Why
/retro globalnarrated "codex was the primary execution tool, 414 sessions across 7 repos" when codex actually drove dev for one repo's middle phase. The other ~309codex_execentries were CC firing codex as a cross-model review subagent. A single bucket can't tell those apart.Scope
Originally this PR carried two patches from #1315. It has since been rebased onto current main and narrowed to Problem 1:
rg "originator"returns nothing inbin/gstack-global-discover.ts.extractCwdFromJsonlcwd-truncation fix landed independently via v1.41.1.0 fix wave: 7 HIGH bugs from external audit + regression tests (PR #1169 follow-up) #1592 / v1.41.1.0 (64KB / 30-line / drop-partial). Main's trade-offs there are deliberate and have regression tests; no reason to re-litigate them from this branch. TheCLAUDE_PROJECTS_DIRtest knob went with it./retro global"sessions = file count, not interactive dev" annotation. Belongs in the retro skill template, and probably deserves its own issue.Because Problems 2 and 3 aren't both resolved here, this uses
Refsrather thanFixesso merging doesn't auto-close #1315.Tests
test/global-discover.test.ts— 35 pass, 0 fail. Covers each bucket, the whitespace-trim case, missing / null / non-string originator →other, and a per-repo sum invariant (desktop + exec + claude_code + other == sessions.codex).Thanks
@Akagilnc for the review that caught the staleness, and for the
.trim()and null-originator suggestions — both are in.