Skip to content

refactor(agent): one client.Identify entry point; label OpenCode and Pi - #1331

Merged
amiddavid merged 18 commits into
mainfrom
feat/agent-claudecode
Nov 25, 2026
Merged

amiddavid merged 18 commits into
mainfrom
feat/agent-claudecode

Conversation

@amiddavid

@amiddavid amiddavid commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Behavior changes (need a human yes)

  1. Pi gets its own dashboard label. Who: Pi users who route through the proxy. Old: request rows show the provider SDK name (anthropic, openai). New: Label pi, and the entry point on the row is other (as before, from the SDK User-Agent). The Pi plugin sets x-context-guru-client: pi; the proxy never forwards it. Turn off: remove the one header line in pi-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)
  2. OpenCode session id. Who: OpenCode users without the plugin's x-context-guru-session header. Old: no header id. New: x-opencode-session-id is 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, and x-opencode-parent-session-id for a subagent). With the Context Guru plugin, x-context-guru-session wins first, so only OpenCode without the plugin is affected. Turn off: drop the SessionID line for OpenCode in agent/identify.go. Human yes: refactor(agent): one client.Identify entry point; label OpenCode and Pi #1331 (comment)
  3. Codex session alias and recognition. Human yes: refactor(agent): one client.Identify entry point; label OpenCode and Pi #1331 (comment) (changes 2 and 3 of the first list). Codex is recognised by the User-Agent or originator prefix, 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.Name to compactionpoint.Client (compactionClient in proxy/compactioncfg.go) and deletes compactionpoint.ClientOf. Settings.Pick takes a Client.

Summary

  • One entry point: agent.Identify(http.Header) agent.Client. Headers only. No path. No registry lookup.
  • It replaces: dash.AgentFor's rule, clientOf, clientEntrypoint, and the Claude Code subagent header read in proxy/thread.go.
  • A nil or empty header gives the generic client (Label and SDK "unknown", the rest empty).
  • The proxy holds no client rules. It calls identify(r) once per request and passes the Client to 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), then Client.SessionID. In Cortex there is no route agent: pass nil, and pass pctx.SessionID as the header value when it is set.

Closes #1312

The Client

Field Meaning
Label harness label for the dashboard. Old values unchanged, plus opencode and pi
SDK the User-Agent family, as the label was before. Differs from Label only for Pi
Name narrow identity for rules: claude, bob, codex, opencode, pi, or empty
Entrypoint cli, headless, sdk, other
SessionID Codex session-id; OpenCode x-opencode-session-id
AgentID, AgentIDHeader Claude x-claude-code-agent-id (checked with thread.ValidHeaderID); Codex thread-id
ParentID Codex x-codex-parent-thread-id; OpenCode x-opencode-parent-session-id

SDK is kept for hosts and rules that need the provider SDK family. Nothing in the proxy reads it now.

Compaction is true when the headers mark the client's own compaction.

Per-client rules are plain functions: agent/claudecode, agent/opencode, agent/pi, and agent/codex from #1322 (codex.Identify, no second parser). Bob keeps the route registry.

Readers of the label (also in docs/design.md; the rule is in pi-package/README.md)

Reader Choice Why
Dashboard request rows (Event.Agent, filters) Label (pi) wants the harness
Keep-alive ping rows (main_run.go, from Record.Agent) raw User-Agent, unchanged Pi ping rows keep the SDK token
Predictive model, live (Record.Agent, LiveFacts.Agent, predictiveDecide) raw User-Agent, unchanged no model input change here. The live/training skew is #1349
Predictive model, stored rows (campaign/replay.go) agent.ModelAgentOf(label, provider) (agent/identify.go, called from campaign/replay.go) a stored Pi row says pi. The provider column gives a token back: openai, anthropic, or the provider string
Compaction point (compactioncfg.go) Name Pi and OpenCode have no setting: the table applies, as before
Entry point on the row Entrypoint Pi gets other, as with its SDK User-Agent
dash/kvcache.go (offline rows) Label reads the stored column. The provider is its own column in the same row
Provider route logic none uses the route and provider, not the label

What changed

  • pi-package/README.md: a section on the Pi header, Label vs SDK, 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) calls agent.IdentifyUserAgent(ua).Label.
  • proxy/clientid.go: identify(r). agent.ModelAgentOf is in agent/identify.go. The compaction point takes compactionClient(Client). The capture holds a Client.
  • Client.Compaction (from feat(thread): detect the client's own compaction for Codex, OpenCode and Pi #1335): Identify fills it from the plugin header and Codex's turn-metadata header. agent.MarkedCompaction(client, body) and agent.IsClientCompaction(client, body) add the body mark and the prompt match. agent/all keeps thin wrappers. readGatedBody takes the Client, so the 128 MiB rule has the same inputs.
  • proxy/thread.go: uses AgentID only when it came from Claude's header, so Codex and OpenCode ids change no thread result here. The cg.thread_header_invalid debug log is gone: Identify drops an invalid id.
  • thread.AgentHeader stays as an alias of claudecode.AgentHeader. thread.HeaderAgentID is now the one parser of the id's form; Identify calls it.
  • Pi plugin sets 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 of chat and compact, and passes the Client to newCapture, compactionPointFor, explicitSessionOf, serve and threadFor. No site calls it again.

What stayed, and why

For the other issues

Data dependence

No change. Header values only. Nothing new is stored.

How it was tested

macOS, Go 1.27.4. RESULTS_PLACEHOLDER

Open questions

  • Pi ping rows keep the SDK token because Record.Agent is one value. Should a later PR split it, so ping rows also say pi?

@amiddavid amiddavid changed the title refactor(agent): add agent/claudecode; label OpenCode and Pi clients refactor(agent): one client.Identify entry point; label OpenCode and Pi Nov 24, 2026
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Behavior changes 2 and 3: approved by a human developer.

@amiddavid approved these on 2026-11-24, in the session that owns this PR:

  • 2. Codex session alias: the proxy reads session-id only from a request whose User-Agent or originator header starts with codex.
  • 3. Codex recognition: the proxy also recognizes Codex by the originator header, not only by the User-Agent prefix.

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 (pi) or the provider field.

Condition: the proxy-boundary session (#1309, #1315) must confirm the proxy-side design before this PR merges.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

Proxy/library split: confirmed by the proxy-boundary session (#1309, #1315), with these changes.

  1. agent/client is OK as the one entry point; the import cycle is a valid reason. The package doc must say: "every host calls Identify once per request and passes the Client down".
  2. A thin identify(r) in the proxy is OK. The proxy calls it once per request and passes the Client down. compactioncfg.go must not call it again.
  3. client.FromUserAgent(ua) is OK, but only for callers that have nothing but a stored User-Agent, such as dashboard rows. Request paths use Identify.
  4. session/session.go reads metadata.user_id from the body, which is a Claude Code rule. It stays for now, with a TODO that points to agent/claudecode. The PR lists it under what stayed.
  5. thread.HeaderAgentID must change, because 2 functions now read the same header. thread takes Client.AgentID instead. A 1-line wrapper that calls claudecode is also OK.
  6. Moved from feat(agent): key Codex sessions by Codex's own session-id header (#1311) #1322: one library function holds the order of the session ids, the panic recovery, and the x-context-guru-session header name. The proxy keeps only the route lookup. In Cortex, pctx.SessionID is the explicit id when it is set.
  7. Behavior change: the top of the PR must name Pi's new dashboard label and its entry point "other".
  8. refactor(compactionpoint): move the compaction-point choice out of the proxy #1320 conflict: whichever PR merges second maps Client.Name to compactionpoint.Client and deletes compactionpoint.ClientOf.

@amiddavid
amiddavid force-pushed the feat/agent-claudecode branch from 99ee4c1 to b3c29fb Compare November 24, 2026 10:06
@amiddavid

Copy link
Copy Markdown
Collaborator Author

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.

  • Change: Pi traffic shows as pi (Label) on the dashboard. Every rule that depends on the provider keeps the SDK name (SDK) or reads the provider field, as the table lists.
  • Added request: a README next to the Pi plugin that explains this rule, so later changes keep it.

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]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Final design: confirmed by the proxy-boundary session at head 8845b46c.

Every point is OK. Two notes:

  1. proxy/keepalive.go: pass the Client that chat already has down to recordTouch and predictiveDecide, and do not call identify(r) again. If that needs wide signature changes, identify(r).SDK is acceptable for now, with a comment that says why.
  2. Expected conflict with refactor(keepalive): move wait windows, signal and manual ping rules (2/2) #1338: the overlap is only the predictiveDecide and Record{Agent:} lines. Whichever PR merges second takes the other's form.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

Behavior change (OpenCode session key): approved by a human developer.

@amiddavid approved it on 2026-11-24, in the session that owns this PR.

  • Change: when no other session id is present, OpenCode traffic is keyed by OpenCode's own x-opencode-session-id (OpenCode 2.4.1, packages/core/src/session/model-request.ts:323-324), not by a content hash.
  • Who: only OpenCode traffic that does not go through the context-guru plugin. The plugin's x-context-guru-session header wins first.

Every behavior change in this PR now has a human's yes.

@amiddavid
amiddavid force-pushed the feat/agent-claudecode branch from 88da54b to 2296531 Compare November 24, 2026 11:01

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. 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.agentFromUserAgent has no "opencode" in its known list, so the label is the first token: "ai-sdk". The new label matches "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, plus opencode and pi", and TestLabelsAreUnchanged (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 (removed agentFromUserAgent): known list is claude-code, claude-cli, codex, cursor, cline, aider, gemini-cli, bob — no "opencode" — then IndexAny(l, "/ ") returns "ai-sdk". New label (agent/identify.go:120) adds "opencode" to the same contains list, so strings.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.

Non-blocking

  • proxy/clientid.go:21 — modelAgentOf loses 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/claudecode has AgentID; there is no SubagentID.
  • 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 fills SessionID for a UA-labeled OpenCode request.
  • apply/apply.go:396 — routeSessionID logs through the global slog. 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.go and 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.ExplicitSessionFor against the old explicitSessionOf (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.Name switch against the old clientOf: bob and claude match exactly as before; codex now also matches the originator header, 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: pi only on routed requests; copyHeaders (proxy.go:3187) drops every x-context-guru-* header, so it never goes upstream (test covers it). pi.Is trims and folds case.
  • Record.Agent / LiveFacts.Agent. Traced both to their readers: main_run.go:1144 wraps them in dash.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. threadFor uses cl.AgentID only when it came from Claude's header, so Codex and OpenCode ids change no thread result. Identify validates the id through thread.HeaderAgentID for every client, as the old direct read did. No import cycle: thread imports only agent/claudecode.
  • Removed functions (agentFromUserAgent, clientOf, clientEntrypoint, codexSessionID, agentSessionID): no callers left.
  • Fail open. Identify(nil) and empty headers give the generic client; nil requests in identify are handled; accRun's wire capture never reads c.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 amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. 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} — no opencode.
      The new label() adds opencode and matches with strings.Contains. So
      ai-sdk/x opencode/2 now hits the known list instead of the first-token rule.
      The PR says "Old values unchanged, plus opencode and pi", which is not true for this
      case. The test TestLabelsAreUnchanged (agent/identify_test.go) says "These are the
      dashboard labels dash.AgentFor gave before this refactor" — false for that entry: the old
      code gave ai-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 (as clientOf did for Bob and Codex), which keeps every old label.
      Then correct the test comment.
  2. 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:244 has agent: r.UserAgent(), :1096 has
      Agent: c.agent (the raw User-Agent); proxy/keepalive.go:468 has Agent: r.UserAgent().
      The head has Agent: c.agent.SDK and Agent: sdk. The stored rows the model was trained
      on always held the label (dash/store.go:665 writes e.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.

Non-blocking

  • proxy/clientid.go:20 — modelAgentOf maps every Pi row whose provider is not openai to
    anthropic.
    Pi today routes only anthropic and openai (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/claudecode exports
    AgentID, a function. No SubagentID exists.
  • proxy/compactioncfg.go:141 — the comment still says "clientOf below". This PR deleted
    clientOf.
  • agent/imports_test.go:11 — the comment lists only agent/bob and agent/codex. The guard
    now covers six packages.
  • apply/apply.go:404 — the panic log lost its request context. The old proxy code logged
    through logging.From(r.Context()); routeSessionID uses slog.Error, so the log loses the
    request logger's fields.
  • agent/identify.go:160 — the break is redundant. The inner switch has no codex case, 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.Identify against every rule it replaced: dash.AgentFor (labels), clientOf
    (compaction names), clientEntrypoint (entry points), the Claude subagent header read in
    proxy/thread.go, and codexSessionID. For Claude Code, Codex-by-prefix, Bob and unknown
    clients, the compaction name is unchanged. thread.HeaderAgentID semantics are preserved
    (id != "" is equivalent to the old ok).
  • No import cycle: agent imports thread; thread imports agent/claudecode, which imports
    nothing from this module.
  • Session order in apply.ExplicitSessionFor against the old explicitSessionOf: 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 every x-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), adaptcache and cg-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 new Client.
  • 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]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Reply to reviewer 1, round 1. Fixed in the next commit.

  1. Blocking, "opencode" label: fixed. The label list no longer has opencode. A User-Agent keeps its first token, so ai-sdk/x opencode/2 is ai-sdk again, as before. opencode/<version> is still opencode (first token). Client.Name uses the first token. The test comment is fixed. A new entry expects ai-sdk.
  2. Blocking, live model input: fixed. The live paths read the raw User-Agent again: LiveFacts.Agent (new capture.ua), predictiveDecide and Record.Agent. No model input changes in this PR, Pi included. The skew is real. It is a separate issue: fix(predictive): live agent feature uses the raw User-Agent, training rows use the label #1349. It holds your proof. A fix changes ping decisions for every client with a learned campaign, so it needs a human yes.
  3. modelAgentOf: fixed. A Pi row returns the provider string. openai and anthropic are the SDK tokens of Pi's two routed providers. Another provider has no known token, so it gives its own name, an unseen value for the model. The comment says so. Stale comments fixed: thread/host.go (now AgentID), compactioncfg.go (no clientOf), agent/imports_test.go (all packages).
  4. Redundant break: fixed. I rewrote the Codex branch as if/else.
  5. Import group, dash/event.go and proxy/dashcapture.go: not changed. It is cosmetic. gofmt accepts it.
  6. Global slog in apply.routeSessionID: not changed. The library has no request context. A host that needs the request logger can wrap route.SessionID itself. I will add an optional logger when a host asks.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

Reply to reviewer 2, round 1. Fixed in the next commit.

  1. Blocking, "opencode" label: fixed. Same as reviewer 1, point 1: no old label changes. ai-sdk/x opencode/2 is ai-sdk.
  2. modelAgentOf: fixed. A Pi row returns the provider string, so a non-openai provider is not turned into anthropic. asyncopenai has no Pi source: Pi sends the JS SDK token openai. The comment says this.
  3. Stale SubagentID comment: fixed (thread/host.go).
  4. Human yes for changes 1 and 2: linked. They are in the PR body now. The Pi label: refactor(agent): one client.Identify entry point; label OpenCode and Pi #1331 (comment). The OpenCode session key: refactor(agent): one client.Identify entry point; label OpenCode and Pi #1331 (comment).
  5. OpenCode override: fixed. It now runs only for a client with no Name. A Claude, Bob, Codex or Pi client keeps its own Name. An unnamed client with OpenCode headers still gets SessionID. A test covers both.
  6. Global slog in apply.routeSessionID: not changed. The library has no request context. See reply to reviewer 1, point 6.
  7. Live model input (your trace of Record.Agent): it is now the raw User-Agent again, so this PR changes no model input. The skew you found is issue fix(predictive): live agent feature uses the raw User-Agent, training rows use the label #1349.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, so ai-sdk/x opencode/2 labels "ai-sdk" again. opencode/<version> still labels "opencode" through the first-token rule, as on the base. The test comment is corrected and TestLabelsAreUnchanged now 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.Agent reads the new capture.ua (the raw User-Agent, dashcapture.go:247 and :1099), and recordTouch passes r.UserAgent() to predictiveDecide and Record.Agent again (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 on asyncopenai is right: that token came from the AsyncOpenAI Python SDK's User-Agent, and Pi routes through the JS SDK, which sends openai. No Pi source produces asyncopenai.
  • Mine, round 1, non-blocking stale SubagentID comment: fixed (thread/host.go:11 now says AgentID).
  • 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 Name is 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: apply is a library package with no request context, and a host that wants its request logger can wrap route.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 Identify structure (agent/identify.go:86-116): the codex branch as if/else has the same semantics as the old switch with break. The OpenCode block runs only for an unnamed client: headers first, else the first User-Agent token equal to "opencode" (FieldsFunc on "/" and " ", the same separators label uses). A pi, bob, codex or claude request keeps its Name. opencode/1.2.3 with no headers still gets Name opencode; ai-sdk/x opencode/2 gets none.
  • Label parity with the base. The known list matches the removed agentFromUserAgent exactly. 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.ua is set from r.UserAgent() in newCapture; LiveFacts.Agent, predictiveDecide's argument and Record.Agent carry the raw User-Agent again, as at the base. The wire capture in accountant_wire.go does not read ua.
  • modelAgentOf returns the provider for a Pi row; test covers bedrock. Non-pi labels pass through.
  • Docs. docs/design.md and pi-package/README.md readers tables now match the code (raw User-Agent for the model paths, provider string for stored Pi rows). Stale comments in compactioncfg.go, thread/host.go and agent/imports_test.go are 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 amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. "opencode" label match (agent/identify.go) — fixed. The known list in label() is back
    to the base set (no opencode), so ai-sdk/x opencode/2 gets ai-sdk again, as on base
    98c9a74. opencode/<version> still gets opencode from the first-token rule, as before.
    Client.Name for OpenCode now comes from a first-token check on the User-Agent or from
    OpenCode's own headers. TestLabelsAreUnchanged expects ai-sdk and its comment now says
    why. Verified against the base agentFromUserAgent.
  2. Live model input (proxy/dashcapture.go, proxy/keepalive.go) — fixed by revert. The live
    paths read the raw User-Agent again: LiveFacts.Agent is the new capture.ua
    (r.UserAgent(), dashcapture.go:247,1099), and recordTouch passes r.UserAgent() to
    predictiveDecide and Record.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

  • modelAgentOf returns the provider string (proxy/clientid.go:23). For openai and
    anthropic this equals the old SDK token; another provider returns its own name, an unseen
    value, as the old unknown SDK token was. Comment and test (bedrock case) say so. Agree.
  • The OpenCode override now runs only when Client.Name is 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. Test TestOpenCodeNameKeepsEveryOtherName covers 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 break rewritten as if/else. Verified; control flow is the same.
  • Import grouping not changed. Cosmetic, gofmt accepts it. Accept.
  • Global slog in routeSessionID not changed. The reason is sound: the library has no
    request context, and a host that wants the request logger can wrap route.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 reads Client.SDK anymore, 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 get Name = opencode where 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.txt is 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.Identify at 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 of Client.SDK remains.
  • 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]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Output of scripts/release/approval-still-valid.sh 1331 ca4d225, run at head d4cd32e:

approved: ca4d2252e033 (base e31ed42f4664) patch-id 7f945cc766f5
head:     d4cd32eebe61 (base f5a77414e362) patch-id 77771e42df44
--- git range-diff
1:  6a88256f = 1:  6a88256f refactor(agent): one agent.Identify entry point from the headers
2:  60b1e184 = 2:  60b1e184 refactor(agent): one Identify per request; one session-id order function
3:  22965311 = 3:  22965311 docs: explain the Pi client header and the readers of the label
4:  28d524f4 = 4:  28d524f4 refactor(proxy): identify the client once in keep-alive record
5:  2a860266 = 5:  2a860266 refactor(proxy): pass the request's Client to serve and threadFor
6:  c79859ef = 6:  c79859ef fix(agent): keep every old label and the live model input; tighten OpenCode
7:  391edd4a = 7:  391edd4a refactor(agent): fold the compaction mark into Client
-:  -------- > 8:  d4cd32ee docs(proxy): name agent.IsClientCompaction in two comments
CHANGED: the head has new code or a conflict resolution. Each reviewer re-checks the delta.

Reading:

Verdict: the reviewers need to re-check only d4cd32e (2 comment lines). The code is the approved code.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

Reply to the round 3 notes.

  1. PR body stale: fixed. I updated it with gh api -X PATCH and read it back. ClientOf is described as deleted and mapped (compactionClient). ModelAgentOf is in agent/identify.go and is called from campaign/replay.go. The body names Client.Compaction and says readGatedBody takes the Client.
  2. Two comments: fixed in d4cd32ee. proxy/proxy.go lines 1288 and 1739 now say agent.IsClientCompaction with the request's Client. Only // lines changed.
  3. docs/design.md readers row: not touched. It goes into fix(keepalive): read Codex and OpenCode subagents, stop reading human for other clients #1318, as you said.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

The approvals from round 3 (at ca4d2252) still hold at d4cd32ee. The owning session checked each step.

  1. ca4d2252 → 690a90aa: a clean merge of main, for refactor(campaign): move the adapt recommendation choice out of the proxy (3/3, #1302) #1334.
    • git show --remerge-diff 690a90aa is empty, so no conflict was resolved by hand.
    • approval-still-valid.sh on 690a90aa printed SAME CHANGE: only the base moved.
  2. 690a90aa → d4cd32ee: comments only. Two // lines in proxy/proxy.go now name agent.IsClientCompaction with the request's Client. Nothing else changed.
    • Under the owner's rule of 2026-11-08, a comments-only commit keeps the approvals.

approval-still-valid.sh on d4cd32ee prints CHANGED, because it compares both steps at once. Each step on its own is covered by RELEASING.md, "When the head moves after an approval".

@amiddavid amiddavid closed this Nov 24, 2026
@amiddavid amiddavid reopened this Nov 24, 2026
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 24, 2026
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Local tests at d4cd32eebe61: fail (Darwin, go1.27.4)

Step Result
vet pass
build-purego pass
build-record pass
vet-record pass
depguard pass
race-proxy pass
race-dash pass
race-plugin pass
race-rest FAIL
race-record known laptop failure: TestNoHooksKeepsTheBinaryDefaults

Skipped: TestBobReleasePythonSuite (Bob plugin on hold, #1221).

Log tail of race-rest:

    --- FAIL: TestHostedModeRefusesCaptureEnv/CONTEXT_GURU_CAPTURE (15.02s)
        hostedenv_test.go:81: hosted mode BOOTED with CONTEXT_GURU_CAPTURE set; it must refuse to start.
            output:
            WARNING: sonic/ast only supports (go1.17~1.26 and amd64 CPU) or (go1.20~1.26 and arm64 CPU), but your environment is not suitable and will fallback to encoding/json
FAIL
FAIL	github.com/rossoctl/context-guru/proxyapp	144.670s
ok  	github.com/rossoctl/context-guru/proxyapp/metricspush	21.962s
ok  	github.com/rossoctl/context-guru/schema	2.052s
ok  	github.com/rossoctl/context-guru/session	1.891s
ok  	github.com/rossoctl/context-guru/store	54.716s
ok  	github.com/rossoctl/context-guru/tenant	121.679s
ok  	github.com/rossoctl/context-guru/thinkcount	2.945s
ok  	github.com/rossoctl/context-guru/thread	5.202s
ok  	github.com/rossoctl/context-guru/tooldefer	7.674s
FAIL
  • race-record failed only on known laptop failures: TestNoHooksKeepsTheBinaryDefaults

@amiddavid

Copy link
Copy Markdown
Collaborator Author

Merge of main (with #1366): the approvals carry over.

  • Head: 7c9c3cb8, a signed-off merge commit. git show --remerge-diff is empty, so no conflict was resolved by hand.
  • approval-still-valid.sh 1331 d4cd32ee:
6:  c79859ef = 6:  c79859ef fix(agent): keep every old label and the live model input; tighten OpenCode
7:  391edd4a = 7:  391edd4a refactor(agent): fold the compaction mark into Client
8:  d4cd32ee = 8:  d4cd32ee docs(proxy): name agent.IsClientCompaction in two comments
SAME CHANGE: only the base moved. The approval of d4cd32eebe61 still counts. Say so on the PR.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

Local tests at 7c9c3cb8a96c: pass (Darwin, go1.27.4)

Step Result
vet pass
build-purego pass
build-record pass
vet-record pass
depguard pass
race-proxy pass
race-dash pass
race-plugin pass
race-rest known laptop failure: TestNoHooksKeepsTheBinaryDefaults
race-record known laptop failure: TestNoHooksKeepsTheBinaryDefaults
node-timing skipped (timing tests off: the integrator runs them)

Skipped: TestBobReleasePythonSuite (Bob plugin on hold, #1221).
timing tests: skipped (integrator runs them)

  • race-rest: flaky on the 1st run, passed on the rerun: TestImportHistoryIsANoOpThatExits TestRowQuotaDefaultIsNonZero
  • race-rest failed only on known laptop failures: TestNoHooksKeepsTheBinaryDefaults
  • race-record failed only on known laptop failures: TestNoHooksKeepsTheBinaryDefaults

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 amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in proxy/proxy.go (the readGatedBody gate comment and the maxCompactionRequestBytes comment) now name agent.IsClientCompaction with 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: the internal/compactionpoint → compactionpoint path 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.CompactionGate now holds the gate block the PR's agentCompaction feeds; apply and dashcapture restructures). 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.Name through compactionClient and deletes ClientOf. The stored-rows row names agent.ModelAgentOf in agent/identify.go, called from campaign/replay.go. "What changed" names Client.Compaction and says readGatedBody takes 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 modelAgentOf and 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 takes SDK; 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-diff claims 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). TestHostedModeRefusesCaptureEnv in proxyapp failed. 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.sh at 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.txt is 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..ca4d2252 against git 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, public compactionpoint import), proxy/clientid_test.go (public import), proxy/proxy.go (the two comments, readGatedBody(w, r, cl, …), lifecycle.CompactionGate fed by the PR's agentCompaction), dash/event.go, docs/design.md. No leftover internal/compactionpoint reference in the PR's files; no leftover agent/all.IsClientCompaction in 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 amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (the readGatedBody gate comment and the maxCompactionRequestBytes
    comment). It fixes the round-3 note about the stale agent/all.IsClientCompaction name.
    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: MakeThreadOf returns h.threadFor(r, cl, …), ObserveSession calls
      h.explicitSessionOf(r, cl, …), readGatedBody takes cl. Same inputs as the approved
      code.
    • 2c2a189: compactionpoint/clientdash_test.go stays deleted (the PR deleted its
      internal/ twin; main's #1369 publicize renamed it). Its replacement,
      TestCompactionClientKeepsTheOldPicks with the inline dash check, is present. The import
      paths in proxy/clientid_test.go and proxy/dashcapture.go now use the public
      compactionpoint.
    • 690a90a and 7c9c3cb: clean (--remerge-diff empty).
  • 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 to internal/compactionpoint, compactionpoint.ClientOf or
    agent/all.IsClientCompaction remains 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 the compactionClient mapping 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 ClientOf is deleted and mapped by
    compactionClient, places ModelAgentOf in agent/identify.go called from
    campaign/replay.go, and names Client.Compaction and readGatedBody taking 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 now 2c2a189c.
    The CLAUDE.md rule says every new commit, even comment-only, needs a new run before the
    hand-off. The owning session must run scripts/dev/local-tests.sh at the final head. (The
    fail at d4cd32ee was TestHostedModeRefusesCaptureEnv in 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 from origin/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.txt is 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..HEAD compared with the round-3 diff
    e31ed42f..ca4d2252, with internal/compactionpoint normalized to compactionpoint: the
    only differences are index hashes, shifted hunk positions from main's refactors, the two
    d4cd32e comment lines, and the import-order shift in proxy/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]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

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".

  • Each round reviews only the latest merge of main.
  • The integrator holds all merges into main until this PR lands.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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..HEAD holds two merges of origin/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.md places main's #1365/#1377 cache-lifetime section before this PR's "Identify the client" section — both kept. proxy/proxy.go's serve signature takes BOTH this PR's cl agent.Client and main's touchAtMs, touchSeq (from #1380); the call site passes both.
    • 09f1e1c: campaign/replay.go's row keeps BOTH this PR's agent.ModelAgentOf(r.Agent, r.Provider) and main's Cause: r.WaitingFor (from #1386).
  • 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.Compaction and the compactionClient mapping 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.txt is 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..2c2a189c against git 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's touchAtMs/touchSeq, #1386's Cause, #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 amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md keeps #1380's one-record section beside this PR's "Identify the
      client" section. proxy/proxy.go's serve keeps both this PR's cl agent.Client and
      main's new touchAtMs, touchSeq int64 parameters; the newRecCtx call passes the new
      fields.
    • 09f1e1c: campaign/replay.go keeps both this PR's agent.ModelAgentOf(r.Agent, r.Provider) and main's #1386 Cause: r.WaitingFor on the same line.
  • 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..HEAD compared with the round-4 diff, path-normalized:
    36 changed lines, all main-side context — hunk shifts in apply/apply.go (#1380's new
    imports above ExplicitSessionFor), the Cause field in campaign/replay.go, the store-off
    paragraph in docs/design.md, and the serve/newRecCtx signature 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, compactionClient and 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 of main; the integrator holds merges into
    main until 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 carries Local 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 from origin/main through 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.txt is 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.ClientOf in code, no agent/all.IsClientCompaction in the proxy comments);
    the round-5 diff touches none of those.
  • I did not run builds or tests (not approved for this review).

@amiddavid
amiddavid merged commit 95bd776 into main Nov 25, 2026
10 checks passed
@amiddavid
amiddavid deleted the feat/agent-claudecode branch November 25, 2026 11:16
amiddavid added a commit that referenced this pull request Nov 25, 2026
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]>
amiddavid added a commit that referenced this pull request Nov 25, 2026
- 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]>
amiddavid added a commit that referenced this pull request Nov 25, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

refactor(agent): move Claude Code rules into agent/claudecode; add OpenCode and Pi labels

1 participant