Repository navigation
refactor(agent): one client.Identify entry point; label OpenCode and Pi - #1331
Conversation
|
Behavior changes 2 and 3: approved by a human developer. @amiddavid approved these on 2026-11-24, in the session that owns this PR:
Change 1 (Pi label) is not approved yet. It waits for the list of every place that reads the label. Each place must use either the client ( Condition: the proxy-boundary session (#1309, #1315) must confirm the proxy-side design before this PR merges. |
|
Proxy/library split: confirmed by the proxy-boundary session (#1309, #1315), with these changes.
|
99ee4c1 to
b3c29fb
Compare
|
Behavior change 1 (Pi label): approved by a human developer. @amiddavid approved it on 2026-11-24, in the session that owns this PR, after reading the "Readers of the label" table.
All 3 behavior changes in this PR now have a yes. The proxy-boundary changes posted above must still be done before the review. |
Identify names the client from headers only and replaces dash.AgentFor's rule, clientOf, clientEntrypoint and the Claude Code subagent header read. Per-client rules are plain functions in agent/claudecode, agent/codex, agent/opencode and agent/pi. Pi is marked by x-context-guru-client. Client.SDK keeps the User-Agent family for logic that depends on the provider. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
The proxy calls Identify once and passes the Client to the compaction point, the capture and the session id. apply.ExplicitSessionFor holds the order of the session ids and the recover around the route agent's id. Add a TODO for the Claude Code user_id rule in session. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Final design: confirmed by the proxy-boundary session at head Every point is OK. Two notes:
|
|
Behavior change (OpenCode session key): approved by a human developer. @amiddavid approved it on 2026-11-24, in the session that owns this PR.
Every behavior change in this PR now has a human's yes. |
88da54b to
2296531
Compare
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 | offload-review skill, @amiddaid's session | fresh | 2 of 2 | 1 of 2 | 2a86026608a3 |
blocking |
Verdict: blocking
Findings
- agent/identify.go:120 — the new "opencode" label rule changes dashboard labels that the PR and the test say stay unchanged
- What fails: a User-Agent that contains "opencode" after its first token, for example "ai-sdk/x opencode/2". On the base,
dash.agentFromUserAgenthas no "opencode" in its known list, so the label is the first token: "ai-sdk". The newlabelmatches "opencode" anywhere, so the label is now "opencode". Dashboard rows and the agent filter change for those requests. The PR body says "Old values unchanged, plusopencodeandpi", andTestLabelsAreUnchanged(agent/identify_test.go:29) says "These are the dashboard labels dash.AgentFor gave before this refactor" — false for this entry. A user-visible change that the PR denies is a change breaks the repo rule that every behavior change is named at the top and has a human's yes. - Proof:
git show 98c9a740:dash/event.go(removedagentFromUserAgent): known list isclaude-code, claude-cli, codex, cursor, cline, aider, gemini-cli, bob— no "opencode" — thenIndexAny(l, "/ ")returns "ai-sdk". Newlabel(agent/identify.go:120) adds "opencode" to the same contains list, sostrings.Contains("ai-sdk/x opencode/2", "opencode")returns "opencode". The test entry at agent/identify_test.go:34 asserts the new value under the "unchanged" claim. - Fix: name the change at the top of the PR (who: requests whose User-Agent contains "opencode" outside the first token; old label "ai-sdk", new label "opencode"; turn-off: drop "opencode" from the list in
label) and get the human developer's yes. Or match "opencode" only as the first token, which keeps every old label. Correct the test comment either way.
- What fails: a User-Agent that contains "opencode" after its first token, for example "ai-sdk/x opencode/2". On the base,
Non-blocking
- proxy/clientid.go:21 —
modelAgentOfloses model-feature tokens for Pi rows. A stored Pi row over a provider that is not "openai" always maps to "anthropic" (a google or bedrock provider row says "anthropic"). And the model's agent feature also one-hots "asyncopenai" (predictive/features.go:314, gbsfeatures.go:20): a Pi row over openai maps to "openai", so "asyncopenai" never fires for Pi. Small drift for a subset of Pi traffic. - thread/host.go:11 — the comment names "its SubagentID method".
agent/claudecodehasAgentID; there is noSubagentID. - PR body — behavior changes 1 and 2 record no human yes. Only change 3 says "approved on the PR". Confirm the yes for the Pi label and the OpenCode session id before merge.
- agent/identify.go:169 — the OpenCode override excludes only codex and pi. A request with a Claude or Bob User-Agent that also carries an OpenCode header is relabeled "opencode". Contrived today. Excluding every known
Name(claude, bob as well) would be tighter; keep the block running for the unnamed clients, because it fillsSessionIDfor a UA-labeled OpenCode request. - apply/apply.go:396 —
routeSessionIDlogs through the globalslog. The old proxy path logged through the request's logger (logging.From(r.Context())). The library has no context, so the panic log now lands on the default handler.
What I checked
- Read the full diff (26 files) and the code around each change:
agent/identify.goand the four per-client packages,apply,dash,proxy(proxy.go, keepalive.go, compactioncfg.go, dashcapture.go, thread.go, clientid.go, campaignauto.go),thread/host.go,session/session.go,pi-package. - Session order.
apply.ExplicitSessionForagainst the oldexplicitSessionOf(proxy.go at base): header, body ids, route agent (with the recover), then the client id. Same order; the OpenCode id is the new, named case. Nil headers and a nil route agent are safe; a panicking route agent falls back (test covers it). - Compaction point. The
cl.Nameswitch against the oldclientOf: bob and claude match exactly as before; codex now also matches theoriginatorheader, which the PR names as behavior change 3. Pi and OpenCode fall to the table, as before. - Pi header. The plugin sets
x-context-guru-client: pionly on routed requests;copyHeaders(proxy.go:3187) drops everyx-context-guru-*header, so it never goes upstream (test covers it).pi.Istrims and folds case. Record.Agent/LiveFacts.Agent. Traced both to their readers:main_run.go:1144wraps them indash.AgentFor, which is idempotent on a label;predictiveDecide's fallback path gives the same label as the raw User-Agent did. The live path now feeds the model the label, not the raw User-Agent — this fixes an old inconsistency with stored rows, where the one-hots at predictive/features.go:314 could never fire on live rows.- Claude subagent header.
threadForusescl.AgentIDonly when it came from Claude's header, so Codex and OpenCode ids change no thread result.Identifyvalidates the id throughthread.HeaderAgentIDfor every client, as the old direct read did. No import cycle:threadimports onlyagent/claudecode. - Removed functions (
agentFromUserAgent,clientOf,clientEntrypoint,codexSessionID,agentSessionID): no callers left. - Fail open.
Identify(nil)and empty headers give the generic client; nil requests inidentifyare handled;accRun's wire capture never readsc.agent. - Repo rules. No component changed, so no data-dependence row is due. No binaries or LFS files. Tests wait on conditions; no new sleeps.
- Did not run builds or tests (not approved). Read the PR body; no review comments read.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | 2a86026608a3 |
blocking |
Verdict: blocking
The code is sound. I found no wrong result, no broken fail-open path, no data loss. The two
findings below are behavior changes that the PR does not name at the top. The repo rule
(RELEASING.md) says a human must say yes to each one before merge.
Findings
-
agent/identify.go:181 — the new "opencode" label match changes dashboard labels for User-Agents that contain "opencode" mid-string. The PR does not name this change.
- What fails: a client sends User-Agent
ai-sdk/x opencode/2. Old label:ai-sdk. New label:
opencode. Dashboard rows and filters change for such a client. - Proof: the base list in
dash/event.go(agentFromUserAgent, commit 98c9a74) is
{claude-code, claude-cli, codex, cursor, cline, aider, gemini-cli, bob}— noopencode.
The newlabel()addsopencodeand matches withstrings.Contains. So
ai-sdk/x opencode/2now hits the known list instead of the first-token rule.
The PR says "Old values unchanged, plusopencodeandpi", which is not true for this
case. The testTestLabelsAreUnchanged(agent/identify_test.go) says "These are the
dashboard labels dash.AgentFor gave before this refactor" — false for that entry: the old
code gaveai-sdk. - Fix: name the change at the top of the PR and get the human yes. Or match OpenCode by the
start of the User-Agent (asclientOfdid for Bob and Codex), which keeps every old label.
Then correct the test comment.
- What fails: a client sends User-Agent
-
proxy/dashcapture.go:1097 and proxy/keepalive.go:472 — the live prediction model now reads the agent family token, not the raw User-Agent. This changes model input for every client, and the PR does not name it.
- What fails: a learned campaign scores a request from
claude-cli/2.1.0 (external, cli).
Old live input: the raw User-Agent string. New live input:claude-cli. The one-hots in
predictive/features.go:315(r.Agent == "claude-cli") never fired live before; they fire
now. The GBS categorical (predictive/gbsfeatures.go:357,row.Cat[1]) changes from the
full User-Agent string to the token. Ping counts and spend can change for every client with
a learned campaign, not only Pi. - Proof: base 98c9a74
proxy/dashcapture.go:244hasagent: r.UserAgent(),:1096has
Agent: c.agent(the raw User-Agent);proxy/keepalive.go:468hasAgent: r.UserAgent().
The head hasAgent: c.agent.SDKandAgent: sdk. The stored rows the model was trained
on always held the label (dash/store.go:665writese.Agent, which was
dash.AgentFor(ua)), so the old live path was skewed against its own training data. This
change fixes that skew. But it is still a behavior change in what the model sees, and the
"Behavior changes" list at the top of the PR does not name it. - Fix: add it to the behavior-change list at the top of the PR, with who it affects and the
old and new values. A human says yes there.
- What fails: a learned campaign scores a request from
Non-blocking
- proxy/clientid.go:20 —
modelAgentOfmaps every Pi row whose provider is notopenaito
anthropic. Pi today routes onlyanthropicandopenai(pi-package/README.md), so this is
correct now. A future Pi provider gets a wrong token. Consider returning the provider string
itself, or say the assumption in the comment. - thread/host.go:11 — the comment names "its SubagentID method".
agent/claudecodeexports
AgentID, a function. NoSubagentIDexists. - proxy/compactioncfg.go:141 — the comment still says "clientOf below". This PR deleted
clientOf. - agent/imports_test.go:11 — the comment lists only
agent/bobandagent/codex. The guard
now covers six packages. - apply/apply.go:404 — the panic log lost its request context. The old proxy code logged
throughlogging.From(r.Context());routeSessionIDusesslog.Error, so the log loses the
request logger's fields. - agent/identify.go:160 — the
breakis redundant. The inner switch has nocodexcase, so
control flow is the same without it. - dash/event.go:6 and proxy/dashcapture.go:5 — the repo import sits inside the first stdlib
import group. Cosmetic.
What I checked
- The full diff 98c9a74..2a86026, all five commits, and the code around each change.
agent.Identifyagainst every rule it replaced:dash.AgentFor(labels),clientOf
(compaction names),clientEntrypoint(entry points), the Claude subagent header read in
proxy/thread.go, andcodexSessionID. For Claude Code, Codex-by-prefix, Bob and unknown
clients, the compaction name is unchanged.thread.HeaderAgentIDsemantics are preserved
(id != ""is equivalent to the oldok).- No import cycle:
agentimportsthread;threadimportsagent/claudecode, which imports
nothing from this module. - Session order in
apply.ExplicitSessionForagainst the oldexplicitSessionOf: header, body
ids, route agent (with the panic recover, fail open), then the client id. Identical, plus the
named OpenCode extension. - The Pi header end to end: the plugin sets it only on routed requests;
copyHeaders
(proxy/proxy.go:3193) drops everyx-context-guru-*header, so it never goes upstream. - The prediction-model data path:
LiveFacts.Agent,Record.Agent,predictiveDecide,
kaEntry.agent,KeepAliveReport.Agent,dashEmitter.KeepAlivePing, stored rows
(dash/store.go:665),campaignauto(modelAgentOf),adaptcacheandcg-cache-campaign.
Live and stored values now agree for every client, including Pi (finding 2 names the change). - All callers of the changed signatures (
newCapture,compactionPointFor,threadFor,
serve,explicitSessionOf): every call site passes the newClient. - The PR description: the three named behavior changes match what the code does. Findings 1 and 2
are the two changes I could find that are not named there. - Data dependence: headers only, nothing new stored. I agree with "No change".
- I did not run builds or tests (not approved for this review).
…enCode Match OpenCode by the first token of the User-Agent, so no old label changes. Feed the live prediction model the raw User-Agent again. Let modelAgentOf return the provider for a Pi row. Exclude every named client from the OpenCode override. Fix stale comments. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Reply to reviewer 1, round 1. Fixed in the next commit.
|
|
Reply to reviewer 2, round 1. Fixed in the next commit.
|
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 2 of 2 | c79859ef7862 |
approve |
Verdict: approve
Findings
None.
Earlier findings
- Mine, round 1, "opencode" label (blocking): fixed.
label(agent/identify.go:124) is back to the base's eight-entry list, soai-sdk/x opencode/2labels "ai-sdk" again.opencode/<version>still labels "opencode" through the first-token rule, as on the base. The test comment is corrected andTestLabelsAreUnchangednow expects "ai-sdk". The PR body's "Old values unchanged" claim is now true. - Reviewer 1, round 1, finding 1 ("opencode" label): fixed, same change. I checked it myself; no new proof to add.
- Reviewer 1, round 1, finding 2 (live model input): fixed by revert.
LiveFacts.Agentreads the newcapture.ua(the raw User-Agent, dashcapture.go:247 and :1099), andrecordTouchpassesr.UserAgent()topredictiveDecideandRecord.Agentagain (keepalive.go:390, :468). No model input changes in this PR. The live/training skew both reviewers found is now issue #1349, which is the right call: a fix changes ping decisions for every client with a learned campaign, so it needs a human yes. - Mine, round 1, non-blocking
modelAgentOf: fixed. A Pi row now returns the provider string (clientid.go:24). The author's reason onasyncopenaiis right: that token came from the AsyncOpenAI Python SDK's User-Agent, and Pi routes through the JS SDK, which sendsopenai. No Pi source producesasyncopenai. - Mine, round 1, non-blocking stale
SubagentIDcomment: fixed (thread/host.go:11 now saysAgentID). - Mine, round 1, non-blocking missing human yes: fixed. All three behavior changes now carry a yes link at the top of the PR, and the approving comments are on the PR.
- Mine, round 1, non-blocking OpenCode override breadth: fixed. The override runs only when
Nameis empty (agent/identify.go:108), so claude, bob, codex and pi keep their Name. A test covers the claude case. - Mine, round 1, non-blocking global
slog: rejected by the author. The reason is right:applyis a library package with no request context, and a host that wants its request logger can wraproute.SessionID. Accepted. - Reviewer 1's import-group nit: rejected as cosmetic, gofmt-accepted. Agreed.
What I checked
- Last review: round 1, 2a86026, 2026-11-24T11:26:27Z.
- New commits read: 1 — c79859e "fix(agent): keep every old label and the live model input; tighten OpenCode".
- Read in full: 2 reviews, 7 comments, 0 inline comments (from the three files in my folder).
- New items since my last review: the fix commit c79859e; the author's two reply comments (11:56:40Z and 11:56:41Z); the updated PR body (yes links, "No model input changes", readers table). Each read and checked against the code.
- The new
Identifystructure (agent/identify.go:86-116): the codex branch as if/else has the same semantics as the old switch withbreak. The OpenCode block runs only for an unnamed client: headers first, else the first User-Agent token equal to "opencode" (FieldsFuncon "/" and " ", the same separatorslabeluses). A pi, bob, codex or claude request keeps its Name.opencode/1.2.3with no headers still getsNameopencode;ai-sdk/x opencode/2gets none. - Label parity with the base. The known list matches the removed
agentFromUserAgentexactly. Every round-1 test entry re-traced against the base code: no label changes for any User-Agent. - Model input parity with the base.
capture.uais set fromr.UserAgent()innewCapture;LiveFacts.Agent,predictiveDecide's argument andRecord.Agentcarry the raw User-Agent again, as at the base. The wire capture inaccountant_wire.godoes not readua. modelAgentOfreturns the provider for a Pi row; test coversbedrock. Non-pi labels pass through.- Docs.
docs/design.mdandpi-package/README.mdreaders tables now match the code (raw User-Agent for the model paths, provider string for stored Pi rows). Stale comments incompactioncfg.go,thread/host.goandagent/imports_test.goare fixed. - Repo rules. All three behavior changes are named at the top with a human yes recorded on the PR. No component changed, so no data-dependence row is due. No binaries or LFS files.
- Did not run builds or tests (not approved).
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 2 of 2 | c79859ef7862 |
approve |
Verdict: approve
Both my round-1 findings are fixed. The one new commit changes no model input and keeps every
old dashboard label. I found no new defect in it.
Findings
None.
Round-1 findings, re-checked
- "opencode" label match (agent/identify.go) — fixed. The known list in
label()is back
to the base set (noopencode), soai-sdk/x opencode/2getsai-sdkagain, as on base
98c9a74.opencode/<version>still getsopencodefrom the first-token rule, as before.
Client.Namefor OpenCode now comes from a first-token check on the User-Agent or from
OpenCode's own headers.TestLabelsAreUnchangedexpectsai-sdkand its comment now says
why. Verified against the baseagentFromUserAgent. - Live model input (proxy/dashcapture.go, proxy/keepalive.go) — fixed by revert. The live
paths read the raw User-Agent again:LiveFacts.Agentis the newcapture.ua
(r.UserAgent(), dashcapture.go:247,1099), andrecordTouchpassesr.UserAgent()to
predictiveDecideandRecord.Agent(keepalive.go:390,468). These are exactly the base
values, so this PR changes no model input. The live-vs-training skew is real and now lives in
issue #1349, which exists and holds my round-1 proof. I accept the split: a fix there changes
ping decisions for every client, so it needs its own human yes.
The author's replies, checked
modelAgentOfreturns the provider string (proxy/clientid.go:23). Foropenaiand
anthropicthis equals the old SDK token; another provider returns its own name, an unseen
value, as the old unknown SDK token was. Comment and test (bedrockcase) say so. Agree.- The OpenCode override now runs only when
Client.Nameis empty (agent/identify.go:108).
A Claude, Bob, Codex or Pi request keeps its Name and gets no OpenCode ids. This also closes
reviewer 2's non-blocking point. TestTestOpenCodeNameKeepsEveryOtherNamecovers both sides. - Stale comments fixed:
thread/host.go(now "AgentID function"),compactioncfg.go
("agent.Identify, Client.Name"),agent/imports_test.go(all packages). Verified. - Redundant
breakrewritten as if/else. Verified; control flow is the same. - Import grouping not changed. Cosmetic,
gofmtaccepts it. Accept. - Global
sloginrouteSessionIDnot changed. The reason is sound: the library has no
request context, and a host that wants the request logger can wraproute.SessionID. Accept. - Human yes links. The PR body now links a yes for each of the three behavior changes
(Pi label, OpenCode session id, Codex recognition), and states "No model input changes in this
PR", which the code now matches. No proxy code readsClient.SDKanymore, as the body says.
Non-blocking
- agent/identify.go:112 — the OpenCode token check trims the User-Agent,
label()does not.
A User-Agent with a leading space would getName = opencodewhere the base gave no name.
Go's header parser trims header values, so no real request hits this. Note only.
What I checked
- Last review: round 1, 2a86026, 2026-11-24T11:27:16Z.
- New commits read: 1 — c79859e "fix(agent): keep every old label and the live model input;
tighten OpenCode". - Read in full: 2 reviews, 7 comments, 0 inline comments (from the three files;
.review-in-inline.txtis empty). - New items since my last review: the fix commit c79859e (read in full, below), and the two
author replies at 11:56:40Z and 11:56:41Z (every claim checked, listed above). No other
comments or reviews appeared after my last review. - The full diff 2a86026..c79859e and the code around each change:
agent/identify.go(the new
if/else Codex branch and the OpenCode block),agent/identify_test.go,
proxy/dashcapture.go(capture.ua),proxy/keepalive.go(raw User-Agent restored),
proxy/clientid.go(modelAgentOf),docs/design.md,pi-package/README.md,
thread/host.go,proxy/compactioncfg.go,agent/imports_test.go. agent.Identifyat the new head against the base rules once more: labels, compaction names,
entry points, thread ids, session order — every old result is preserved, except the three
named and approved behavior changes.- Issue #1349 exists, is open, and holds the round-1 proof of the model-input skew.
- The PR body: the three behavior changes each link a human yes; "No model input changes in this
PR" matches the code; no proxy reader ofClient.SDKremains. - I did not run builds or tests (not approved for this review).
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Identify fills Client.Compaction from the plugin header and Codex's turn metadata header. agent.MarkedCompaction and agent.IsClientCompaction take the Client and the body. agent/all keeps thin wrappers. The proxy passes the request's Client, including to the 128 MiB body gate, so the rule's inputs are the same. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Delete compactionpoint.ClientOf and its User-Agent parsing. Settings.Pick takes a Client. The proxy maps agent.Client.Name to it (compactionClient). A test pins every old ClientOf pick, and the Claude rule against dash.AgentFor. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Comment lines only. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Output of scripts/release/approval-still-valid.sh 1331 ca4d225, run at head d4cd32e: Reading:
Verdict: the reviewers need to re-check only d4cd32e (2 comment lines). The code is the approved code. |
|
Reply to the round 3 notes.
|
|
The approvals from round 3 (at
|
|
Local tests at
Skipped: TestBobReleasePythonSuite (Bob plugin on hold, #1221). Log tail of race-rest:
|
Signed-off-by: DAVID AMID <[email protected]>
|
Merge of
|
|
Local tests at
Skipped: TestBobReleasePythonSuite (Bob plugin on hold, #1221).
|
Signed-off-by: DAVID AMID <[email protected]> # Conflicts: # docs/design.md
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.332 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 4 of 4 | 2c2a189c6d16 |
approve --> |
Verdict: approve
Findings
None.
Round-4 changes, reviewed
- One PR-authored commit: d4cd32e "docs(proxy): name agent.IsClientCompaction in two comments". I read the full commit: two
//lines inproxy/proxy.go(thereadGatedBodygate comment and themaxCompactionRequestBytescomment) now nameagent.IsClientCompactionwith the request's Client. No code line changed. This fixes my round-3 non-blocking note on those comments. - Five merges of
origin/main(690a90a, 7c9c3cb, 7bcd258, 3e23bc7, 2c2a189) brought in about 25 main-side commits, each merged through its own PR (#1334, #1366, #1363, #1364, #1342, #1344, #1356, #1367, #1357, #1375, #1374, #1352, #1358, #1360, #1346, #1371, #1381, #1370, #1379, #1359, #1355, #1353, #1369, and more). I read every commit message and stat in the range. - The PR's own patch is unchanged from the approved state. I diffed the round-3 PR diff (
e31ed42f..ca4d2252) against the round-4 PR diff (e24cbb99..HEAD) hunk by hunk. The only content differences: theinternal/compactionpoint→compactionpointpath rewrite (main's #1369 publicize script; the PR files' import lines follow it), d4cd32e's two comment lines, and context-line drift where main refactored around the PR's hunks (lifecycle.CompactionGatenow holds the gate block the PR'sagentCompactionfeeds;applyanddashcapturerestructures). No PR hunk changed meaning.
The author's round-3 replies, checked
- PR body updated: verified. Line 9 now says #1320 is merged, this PR maps
Client.NamethroughcompactionClientand deletesClientOf. The stored-rows row namesagent.ModelAgentOfinagent/identify.go, called fromcampaign/replay.go. "What changed" namesClient.Compactionand saysreadGatedBodytakes the Client. "What stayed" no longer claims ClientOf was untouched. All four round-3 non-blocking points on the body are closed. - Two comments fixed in d4cd32e: verified (see above).
- docs/design.md readers row deferred to #1318: accepted. The row still names
modelAgentOfand the old call site, and reviewer 1's round-3 note on the "Which field to read" bullet (design.md:327 says the prediction model takesSDK; the table at :339 says raw User-Agent) also stands. I checked both: they are stale doc lines, not code. The author defers them to #1318, which owns the Client-wide doc pass. Agree with reviewer 1, round 3, both notes; nothing to add.
The new comments, checked
- 14:20:19Z and 14:36:11Z (approval carry-over). The script output and the step-by-step reading match what I verified independently:
git show --remerge-diffclaims I did not re-run, but my diff-of-diffs gives the same answer — the PR patch is content-identical from ca4d225 through 2c2a189. - 17:08:13Z (local tests FAIL at d4cd32e).
TestHostedModeRefusesCaptureEnvinproxyappfailed. Nothing in this PR touches hosted-mode startup or the capture env; the failure is gone at the next head. - 19:39:28Z (local tests PASS at 7c9c3cb). All steps pass except the known laptop failure (
TestNoHooksKeepsTheBinaryDefaults, listed in CLAUDE.md) and rerun-cleaned flakes. Accepted.
Non-blocking
- The local-tests pass is at 7c9c3cb, not at the final head 2c2a189. The rule in CLAUDE.md says a new commit, even comment-only, needs a new run. Three main-merges followed the passing run. The PR patch is provably unchanged (my diff-of-diffs), so this is a run of
scripts/dev/local-tests.shat the final head before merge, or the integrator's explicit acceptance of the carry-over — not a code change. - docs/design.md:327 and the readers-table row (reviewer 1's round-3 notes): still stale, deferred to #1318. Named here so they are not lost when this PR closes.
What I checked
- Last review: round 3, ca4d225, 2026-11-24T14:02:17Z.
- New commits read: 30 in
ca4d2252..HEAD. PR-authored: d4cd32e (two comment lines). The rest arrived from origin/main through the merges 690a90a, 7c9c3cb, 7bcd258, 3e23bc7 and 2c2a189; each main-side commit read for message and stat, and the merge results checked through the diff-of-diffs below. - Read in full: 6 reviews, 13 comments, 0 inline comments (from the three files in my folder;
.review-in-inline.txtis empty). - New items since my last review: commit d4cd32e; the five merges; six new comments (14:20:19Z, 14:20:20Z, 14:36:11Z, 17:08:13Z, 17:54:37Z, 19:39:28Z); reviewer 1's round-3 review at 14:01:32Z; the updated PR body. Each read and checked against the code.
- Diff-of-diffs:
git diff e31ed42f..ca4d2252againstgit diff e24cbb99..HEAD, with the compactionpoint path rewrite normalized. Every hunk compared: identical PR content except the two comment lines and the import-path rewrite. - Code state at the final head:
agent/identify.go(Label list, OpenCode Name gate,Client.Compaction,agent.ModelAgentOf),proxy/compactioncfg.go(compactionClient, publiccompactionpointimport),proxy/clientid_test.go(public import),proxy/proxy.go(the two comments,readGatedBody(w, r, cl, …),lifecycle.CompactionGatefed by the PR'sagentCompaction),dash/event.go,docs/design.md. No leftoverinternal/compactionpointreference in the PR's files; no leftoveragent/all.IsClientCompactionin the two proxy comments. - Repo rules. No new behavior change in the round-4 range: the PR patch is the approved patch. No component changed, so no data-dependence row is due. No binaries or LFS files.
- Did not run builds or tests (not approved).
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.332 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 4 of 4 | 2c2a189c6d16 |
approve |
Verdict: approve
The PR's own code did not change since my round-3 approve. What moved is the base: 23 commits
from main arrived through 5 merges, and one comment-only commit was added. I compared the PR
diff against the new base with the round-3-approved diff, path-normalized for main's
compactionpoint publicize: the content is identical, apart from shifted context from
main's refactors and the two comment lines. Every merge resolution keeps both sides. No new
defect.
Findings
None.
What changed since ca4d225, checked
- d4cd32e "name agent.IsClientCompaction in two comments". Exactly 2
//lines in
proxy/proxy.go(thereadGatedBodygate comment and themaxCompactionRequestBytes
comment). It fixes the round-3 note about the staleagent/all.IsClientCompactionname.
Verified line by line. - The 5 merges of main (690a90a, 7c9c3cb, 7bcd258, 3e23bc7, 2c2a189). Three carried
hand resolutions; I read each remerge-diff:- 7bcd258 (docs/design.md): keeps both #1357's cache-lifetime section and this PR's
"Identify the client" section. Nothing lost. - 3e23bc7 (proxy/proxy.go): main's lifecycle refactor moved the chat body into
lifecycle.Prepare/Finish. The resolution re-threads this PR's Client through the new
structure:MakeThreadOfreturnsh.threadFor(r, cl, …),ObserveSessioncalls
h.explicitSessionOf(r, cl, …),readGatedBodytakescl. Same inputs as the approved
code. - 2c2a189:
compactionpoint/clientdash_test.gostays deleted (the PR deleted its
internal/twin; main's #1369 publicize renamed it). Its replacement,
TestCompactionClientKeepsTheOldPickswith the inline dash check, is present. The import
paths inproxy/clientid_test.goandproxy/dashcapture.gonow use the public
compactionpoint. - 690a90a and 7c9c3cb: clean (
--remerge-diffempty).
- 7bcd258 (docs/design.md): keeps both #1357's cache-lifetime section and this PR's
- The 23 main-side commits each landed through its own reviewed PR (#1334, #1356, #1342,
#1363, #1344, #1364, #1366, #1367, #1357, #1375, #1374, #1352, #1358, #1360, #1346, #1371,
#1381, #1370, #1379, #1359, #1355, #1353, #1369). I read every commit message and stat, and
checked their effect on this PR through the full diff against the new base and greps: no
stale reference tointernal/compactionpoint,compactionpoint.ClientOfor
agent/all.IsClientCompactionremains in code.
Earlier findings, re-checked
- All round-1 to round-3 findings (both reviewers'): fixed or accepted, as recorded before.
Nothing regressed — the label list, the raw-User-Agent model input,agent.ModelAgentOf's
provider return, the OpenCode Name gate and thecompactionClientmapping are all in the
round-4 diff, byte-for-byte the round-3 content.
The author's round-3 replies, checked
- PR body stale pointers: fixed. The body now says
ClientOfis deleted and mapped by
compactionClient, placesModelAgentOfinagent/identify.gocalled from
campaign/replay.go, and namesClient.CompactionandreadGatedBodytaking the Client.
Read back from the server. - Two stale comments: fixed in d4cd32e. Verified.
- docs/design.md readers row: deferred to #1318. The issue is open. Accepted.
Non-blocking
- No local-tests marker at the final head. The newest pass is at
7c9c3cb8
(2026-11-24T19:39:28Z). Three merges of main landed after it; the head is now2c2a189c.
The CLAUDE.md rule says every new commit, even comment-only, needs a new run before the
hand-off. The owning session must runscripts/dev/local-tests.shat the final head. (The
fail atd4cd32eewasTestHostedModeRefusesCaptureEnvin proxyapp — a package this PR does
not touch — and it passed at the next head.) - docs/design.md "Identify the client" — the "Take
SDK" bullet and the stale readers-row
pointers remain, deferred to #1318 by the author. Unchanged from round 3; still a note.
What I checked
- Last review: round 3, ca4d225, 2026-11-24T14:01:32Z.
- New commits read: 29 in
ca4d2252..HEAD— d4cd32e (comments only) and the merges 690a90a,
7c9c3cb, 7bcd258, 3e23bc7, 2c2a189 are PR-side; the other 23 arrived fromorigin/main
through those merges, each via its own reviewed PR (listed above). Every commit read for
message and stat; the PR-side work and the merge resolutions read in the full diff and the
remerge-diffs. - Read in full: 7 reviews, 13 comments, 0 inline comments (from the three files;
.review-in-inline.txtis empty). - New items since my last review: reviewer 2's round-3 review (14:02:17Z, approve — read in
full, agree, nothing to add); the author's reply to the round-3 notes (14:20:20Z — each claim
verified above); the approval-carryover notes (14:20:19Z, 14:36:11Z — the range-diff and the
comment-only rule check out); local-tests comments (fail at d4cd32e, pass at 7c9c3cb). - Diff parity.
git diff e24cbb99..HEADcompared with the round-3 diff
e31ed42f..ca4d2252, withinternal/compactionpointnormalized tocompactionpoint: the
only differences are index hashes, shifted hunk positions from main's refactors, the two
d4cd32e comment lines, and the import-order shift inproxy/clientid_test.go. The PR's own
changes are identical to the approved round-3 content. - Stale-reference greps at the head:
internal/compactionpoint,compactionpoint.ClientOf
(code),agent/all.IsClientCompaction(proxy/apply) — all clean. Issue #1318 is open. - I did not run builds or tests (not approved for this review).
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Review rounds: no limit for this PR. @amiddavid removed the round limit for this PR on 2026-11-25, in the session that owns it: "yes, no limit for 1331".
|
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.332 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 5 of 20 | 09f1e1c4ebc1 |
approve --> |
Verdict: approve
Findings
None.
Round-5 changes, reviewed
- No PR-authored commit in this round. The range
2c2a189c..HEADholds two merges oforigin/main(208df8c, 09f1e1c) and nine main-side commits (#1392, #1386, #1377, #1376, #1373, #1372, #1362, #1380, #1382), each landed through its own reviewed PR. I read every commit message and stat. - The PR's own patch is unchanged. I diffed the round-4 PR diff (
e24cbb99..2c2a189c) against the round-5 PR diff (22a6e3cb..HEAD): the same 32 files, the same 802 insertions and 261 deletions, and every hunk identical except context lines that moved with main's refactors. - Both merge resolutions keep both sides. I read each
git show --remerge-diff:- 208df8c:
docs/design.mdplaces main's #1365/#1377 cache-lifetime section before this PR's "Identify the client" section — both kept.proxy/proxy.go'sservesignature takes BOTH this PR'scl agent.Clientand main'stouchAtMs, touchSeq(from #1380); the call site passes both. - 09f1e1c:
campaign/replay.go's row keeps BOTH this PR'sagent.ModelAgentOf(r.Agent, r.Provider)and main'sCause: r.WaitingFor(from #1386).
- 208df8c:
- The new team comment (2026-11-25T10:16:05Z) removes the round limit for this PR: each round reviews only the latest merge of main, and the integrator holds merges until this PR lands. This round follows it: I reviewed the latest merge, 09f1e1c, and nothing else moved.
Earlier findings
- All findings from rounds 1 to 4 (both reviewers'): fixed or accepted, as recorded before. Nothing regressed — the label list, the raw-User-Agent model input,
agent.ModelAgentOf, the OpenCode Name gate,Client.Compactionand thecompactionClientmapping are all in the round-5 diff, identical to the approved content. - My round-4 non-blocking note (local-tests run at the final head) is settled by a rule change, not a code change. CLAUDE.md now has the interim rule (owner, 2026-11-24/25): no heavy test runs on the shared laptop; the hand-off carries
Local tests: waived (owner rule)instead. The round-4 requirement I named no longer applies in that form.
Non-blocking
- The PR body does not yet carry the waiver line. Under the interim rule, the hand-off block needs
Local tests: waived (owner rule)in the PR body or a PR comment. One line for the owning session before the hand-off. - The docs/design.md stale lines (the "Take
SDK" bullet and the readers-row pointers) remain, deferred to #1318 — reviewer 1's note from rounds 3 and 4, unchanged. Named so it is not lost; nothing to add.
What I checked
- Last review: round 4, 2c2a189, 2026-11-25T09:12:06Z.
- New commits read: 11 in
2c2a189c..HEAD— the merges 208df8c and 09f1e1c (PR-side, remerge-diffs read in full), and the main-side commits 22a6e3c (#1392), f7496d3 (#1386), 0824500 (#1377), 696ed60 (#1376), 1eef711 (#1373), 630df65 (#1372), 24c25c6 (#1362), e0a304e (#1380), ffcc929 (#1382). Each read for message and stat. - Read in full: 8 reviews, 14 comments, 0 inline comments (from the three files in my folder;
.review-in-inline.txtis empty). - New items since my last review: reviewer 1's round-4 review at 09:12:38Z (read in full, approve, agree with it); the team comment at 10:16:05Z (no round limit; each round reviews only the latest merge — followed); the two merges and their resolutions (checked above); the updated CLAUDE.md interim rule (checked against the PR body). No other new comments.
- Diff parity:
git diff e24cbb99..2c2a189cagainstgit diff 22a6e3cb..HEAD, hunk by hunk: identical PR content, 802/261 over the same 32 files; only hunk positions and context lines moved with main's refactors (#1380'stouchAtMs/touchSeq, #1386'sCause, #1377's design.md section). - Did not run builds or tests (not approved; the interim rule also forbids the heavy suites on this laptop).
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.332 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 5 of 20 | 09f1e1c4ebc1 |
approve --> |
Verdict: approve
The PR's own code did not change since my round-4 approve. Two merges brought in 9 commits from
main, each merged through its own reviewed PR. I compared the PR diff against the new base
with the round-4 diff, normalized: the PR's own hunks are content-identical; every
difference is main-side context around them. Both merge resolutions keep both sides. No new
defect.
Findings
None.
What changed since 2c2a189, checked
- The two merges (208df8c, 09f1e1c). Both carried hand resolutions; I read each
remerge-diff:- 208df8c:
docs/design.mdkeeps #1380's one-record section beside this PR's "Identify the
client" section.proxy/proxy.go'sservekeeps both this PR'scl agent.Clientand
main's newtouchAtMs, touchSeq int64parameters; thenewRecCtxcall passes the new
fields. - 09f1e1c:
campaign/replay.gokeeps both this PR'sagent.ModelAgentOf(r.Agent, r.Provider)and main's #1386Cause: r.WaitingForon the same line.
- 208df8c:
- The 9 main-side commits (#1382 accrec Recorder rules, #1380 the one 1-hour-touch record,
#1362 metrics operator labels, #1372 rate-limiter clock, #1373 keep-alive test clock, #1376
summary-wait floor, #1377 store load timeout, #1386 replay wait-cause floor, #1392 the
interim test rule). Each read for message and stat; their effect on this PR checked through
the full diff against the new base. - Diff parity.
git diff 22a6e3cb..HEADcompared with the round-4 diff, path-normalized:
36 changed lines, all main-side context — hunk shifts inapply/apply.go(#1380's new
imports aboveExplicitSessionFor), theCausefield incampaign/replay.go, the store-off
paragraph indocs/design.md, and theserve/newRecCtxsignature changes. No PR hunk
changed meaning.
Earlier findings, re-checked
- All round-1 to round-4 findings (both reviewers'): fixed, accepted or deferred to #1318, as
recorded before. Nothing regressed: the label list, the raw-User-Agent model input,
agent.ModelAgentOf, the OpenCode Name gate,compactionClientand the comment fixes are
all in the round-5 diff, unchanged.
The new conversation items, checked
- Reviewer 2's round-4 review (2026-11-25T09:12:06Z, approve). Read in full. Its
diff-of-diffs method and its reading of the local-tests comments match my own round-4
results. Agree; nothing to add. - The round-limit comment (2026-11-25T10:16:05Z). The owner removed the round limit for
this PR; each round reviews only the latest merge ofmain; the integrator holds merges into
mainuntil this PR lands. This round follows that: I reviewed the two new merges and the
new base, and confirmed the PR patch is unchanged.
Non-blocking
- The local-tests waiver line is missing. The interim rule (CLAUDE.md, from #1392) says the
hand-off carriesLocal tests: waived (owner rule)in the PR body or a comment, in place of
the local-tests marker. Neither is present, and "How it was tested" still holds
RESULTS_PLACEHOLDER. The owning session must add the waiver line (and fill the section)
before hand-off. My round-4 note about a missing local-tests run at the head is closed by the
interim rule: the heavy tests are waived. - docs/design.md "Identify the client" — the "Take
SDK" bullet and the stale readers-row
pointers remain, deferred to #1318. Unchanged from rounds 3 and 4; still a note.
What I checked
- Last review: round 4, 2c2a189, 2026-11-25T09:12:38Z.
- New commits read: 11 in
2c2a189c..HEAD— the merges 208df8c and 09f1e1c are PR-side; the
other 9 arrived fromorigin/mainthrough them (#1382, #1380, #1362, #1372, #1373, #1376,
#1377, #1386, #1392), each via its own reviewed PR. Every commit read for message and stat;
the merge resolutions read in the remerge-diffs. - Read in full: 8 reviews, 14 comments, 0 inline comments (from the three files;
.review-in-inline.txtis empty). - New items since my last review: reviewer 2's round-4 review (agree, nothing to add); the
round-limit comment (process note, followed); the two merges and the 9 main-side commits
(checked above). No other new comments. - Stale-reference greps stand from round 4 (no
internal/compactionpoint, no
compactionpoint.ClientOfin code, noagent/all.IsClientCompactionin the proxy comments);
the round-5 diff touches none of those. - I did not run builds or tests (not approved for this review).
Add two bullets to RELEASING.md section 3, by owner decision ("add both"):
write issue numbers in a PR body as "Refs #N" only, and freeze every
merge for a PR stuck in a merge-of-main loop.
Refs #1303, #1370, #1331
Assisted-By: Claude Opus 5.5
Signed-off-by: DAVID AMID <[email protected]>
- Claude Code plugin: 0.7.8 -> 0.7.9 (#1391, #1401: start with preset off when the keep-alive strategy is unknown) - Pi: 0.1.7 -> 0.1.8 (#1331: sends x-context-guru-client: pi) - OpenCode: PINNED_VERSION v0.7.8 -> v0.7.9 (index.js, README, install how-to, tests) - Codex 0.2.14 and Bob 0.1.3: unchanged (no change since v0.7.8; Bob has test-only edits) Release bump for v0.7.9. Part A, heavy CI and Part B passed on 246da80. Owner: "notes approved". Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
…eze) (#1405) docs(release): tell the PR owner after every merge Add a bullet to RELEASING.md section 3: after every merge, send the PR owner one message in the same step. Owner decision (David Amid, 2026-11-25): "put the rule into the realsing.md file so other integrators on other machines would know it". Refs #1394, #1388 docs(release): add Refs-only and full-freeze merge rules Add two bullets to RELEASING.md section 3, by owner decision ("add both"): write issue numbers in a PR body as "Refs #N" only, and freeze every merge for a PR stuck in a merge-of-main loop. Refs #1303, #1370, #1331 Docs only. The owner approved the text and the merge with no review round, in the integrator session, 2026-11-25: "1405 merge". Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
Behavior changes (need a human yes)
anthropic,openai). New: Labelpi, and the entry point on the row isother(as before, from the SDK User-Agent). The Pi plugin setsx-context-guru-client: pi; the proxy never forwards it. Turn off: remove the one header line inpi-package/extensions/context-guru.ts. Where logic depends on the provider, it keeps the SDK token (see "Readers of the label"). Human yes: refactor(agent): one client.Identify entry point; label OpenCode and Pi #1331 (comment)x-context-guru-sessionheader. Old: no header id. New:x-opencode-session-idis the session id, after the header, the body ids and the route agent's id. OpenCode sends the header on every model request (sst/opencode 2.4.1,packages/core/src/session/model-request.ts, lines 323-324:x-opencode-session-id, andx-opencode-parent-session-idfor a subagent). With the Context Guru plugin,x-context-guru-sessionwins first, so only OpenCode without the plugin is affected. Turn off: drop theSessionIDline for OpenCode inagent/identify.go. Human yes: refactor(agent): one client.Identify entry point; label OpenCode and Pi #1331 (comment)originatorprefix, and its ids are read only then.Claude Code: no change in any result. No model input changes in this PR: the live prediction model reads the raw User-Agent, as before. The old skew between live and training rows is issue #1349.
This PR is rebased on main after #1322 merged. #1320 is merged: this PR maps
Client.Nametocompactionpoint.Client(compactionClientinproxy/compactioncfg.go) and deletescompactionpoint.ClientOf.Settings.Picktakes aClient.Summary
agent.Identify(http.Header) agent.Client. Headers only. No path. No registry lookup.dash.AgentFor's rule,clientOf,clientEntrypoint, and the Claude Code subagent header read inproxy/thread.go.LabelandSDK"unknown", the rest empty).identify(r)once per request and passes theClientto the capture, the compaction point and the session id.apply.ExplicitSessionFor(h, routeAgent, client, body)holds the session-id order: header, body ids, route agent's id (with the recover), thenClient.SessionID. In Cortex there is no route agent: pass nil, and passpctx.SessionIDas the header value when it is set.Closes #1312
The Client
LabelopencodeandpiSDKLabelonly for PiNameclaude,bob,codex,opencode,pi, or emptyEntrypointcli,headless,sdk,otherSessionIDsession-id; OpenCodex-opencode-session-idAgentID,AgentIDHeaderx-claude-code-agent-id(checked withthread.ValidHeaderID); Codexthread-idParentIDx-codex-parent-thread-id; OpenCodex-opencode-parent-session-idSDKis kept for hosts and rules that need the provider SDK family. Nothing in the proxy reads it now.Compactionis true when the headers mark the client's own compaction.Per-client rules are plain functions:
agent/claudecode,agent/opencode,agent/pi, andagent/codexfrom #1322 (codex.Identify, no second parser). Bob keeps the route registry.Readers of the label (also in
docs/design.md; the rule is inpi-package/README.md)Event.Agent, filters)Label(pi)main_run.go, fromRecord.Agent)Record.Agent,LiveFacts.Agent,predictiveDecide)campaign/replay.go)agent.ModelAgentOf(label, provider)(agent/identify.go, called fromcampaign/replay.go)pi. The provider column gives a token back:openai,anthropic, or the provider stringcompactioncfg.go)NameEntrypointother, as with its SDK User-Agentdash/kvcache.go(offline rows)Labelprovider, not the labelWhat changed
pi-package/README.md: a section on the Pi header,LabelvsSDK, the rule for new readers, and how to turn it off.agent/identify.go:Client,Identify,IdentifyUserAgent(for the dashboard, which has only a User-Agent).agent/claudecode,agent/opencode,agent/pi: header rules.dash.AgentFor(ua)callsagent.IdentifyUserAgent(ua).Label.proxy/clientid.go:identify(r).agent.ModelAgentOfis inagent/identify.go. The compaction point takescompactionClient(Client). The capture holds aClient.Client.Compaction(from feat(thread): detect the client's own compaction for Codex, OpenCode and Pi #1335):Identifyfills it from the plugin header and Codex's turn-metadata header.agent.MarkedCompaction(client, body)andagent.IsClientCompaction(client, body)add the body mark and the prompt match.agent/allkeeps thin wrappers.readGatedBodytakes theClient, so the 128 MiB rule has the same inputs.proxy/thread.go: usesAgentIDonly when it came from Claude's header, so Codex and OpenCode ids change no thread result here. Thecg.thread_header_invaliddebug log is gone:Identifydrops an invalid id.thread.AgentHeaderstays as an alias ofclaudecode.AgentHeader.thread.HeaderAgentIDis now the one parser of the id's form;Identifycalls it.x-context-guru-client: pi.docs/design.md: section "Identify the client", with how the proxy, the bifrost adapter and Cortex call it.One Identify per request
The proxy calls
identify(r)at the top ofchatandcompact, and passes theClienttonewCapture,compactionPointFor,explicitSessionOf,serveandthreadFor. No site calls it again.What stayed, and why
clientSessionAlias: feat(agent): key Codex sessions by Codex's own session-id header (#1311) #1322 makes it return "" for Codex. It only serves a non-Codex caller that sendssession-id. I left it as feat(agent): key Codex sessions by Codex's own session-id header (#1311) #1322 has it.IdentifyUserAgent(ua): only for a caller that has a stored User-Agent (dashboard rows). Request paths useIdentify.session/session.go(metadata.user_id): reads the body, shares keys with Bob. Needs a body hook. A TODO points toagent/claudecode(for exampleclaudecode.SessionFromBody).internal/waitcause: Claude markers are mixed through ~900 lines of generic rules. fix(keepalive): read Codex and OpenCode subagents, stop reading human for other clients #1318 can take aClient.thread/compaction.go: fix(thread): detect client compaction for Codex, OpenCode and Pi #1314 owns it.compactionpoint.ClientOf: deleted. A test pins every old pick (TestCompactionClientKeepsTheOldPicks).For the other issues
Client.AgentID,ParentID; widen the test inproxy/thread.gofrom "Claude header" to "AgentID not empty".ClassifyWaitingForClienttakes aClient.Clientparameter.agent.Identify(pctx.Headers);pctx.SessionIDfills a gap.Data dependence
No change. Header values only. Nothing new is stored.
How it was tested
macOS, Go 1.27.4. RESULTS_PLACEHOLDER
Open questions
Record.Agentis one value. Should a later PR split it, so ping rows also saypi?