Skip to content

chore: extract recorder construction - #30224

Merged
pawbana merged 2 commits into
mainfrom
pawel/issue-29726-recorder
Oct 2, 2026
Merged

pawbana merged 2 commits into
mainfrom
pawel/issue-29726-recorder

Conversation

@pawbana

@pawbana pawbana commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Extract newRecorder from the interception pool into helper.
This lets the proxy use the same recorder construction code.

Generated by Coder Agents on behalf of @pawbana.

@pawbana

pawbana commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-10-01 08:51 UTC by @pawbana

Review history
  • R1 (2026-10-01): 9 reviewers, 1 Nit, 4 P3, 1 P4, COMMENT. Review
  • R2 (2026-10-01): 6 reviewers, 2 Nit, 4 P3, 1 P4, COMMENT. Review

deep-review v0.13.0 | Round 2 | 7dc2cf5..a9e175e

Last posted: Round 2, 7 findings (4 P3, 1 P4, 2 Nit), COMMENT. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Author fixed (a9e175e) pool.go:90 Doc comment claims proxy mode uses newRecorder; no proxy caller exists R1 Gon P2, Leorio P4, Mafu-san P4, Mafuuu Nit Yes
CRF-2 P3 Author fixed (a9e175e) pool.go:103 Moved comment references a handler and context that newRecorder does not have R1 Gon P2, Leorio P4, Meruem Nit, Mafuuu Nit Yes
CRF-3 P3 Author contested; panel closed R2 (2/2 accept) pool.go:91 newRecorder takes all of PoolOptions but reads only the two record-policy fields R1 Ryosuke P3, Meruem P4 Yes
CRF-4 P3 Author fixed (a9e175e) aibridged_internal_test.go:39 TestNewRecorder never asserts the apiKeyID forwarded to the DRPC recorder R1 Bisky P3, Mafuuu Note Yes
CRF-5 P4 Author fixed (a9e175e) aibridged_internal_test.go:40 Test expectations computed by branches and bare 3/6 literals instead of table fields R1 Bisky P4, Gon P4 Yes
CRF-6 Nit Author fixed (a9e175e) aibridged_internal_test.go:36 id should be interceptionID R1 Gon Yes
CRF-7 Note Note (body) pool.go:102 Middleware slice now rebuilt per cache miss, reversing the deleted "resolved once" comment; cost negligible R1 Netero, Gon, Leorio, Mafu-san No
CRF-8 OOS Out of scope (body) aibridge/api.go:91 No aibridge test covers NewRecorder middleware order R1 Bisky No
CRF-9 OOS Out of scope (body) aibridge/recorder/filter_recorder.go:44 FilterRecorder/WithoutRecords have no unit tests R1 Bisky No
CRF-10 Note Dropped by orchestrator (contradicting fixes from Gon and Zoro; comment is accurate per Leorio and follows R1 suggested wording) pool.go:90 newRecorder doc comment restates code R2 Gon P2, Zoro Nit No
CRF-11 Note Dropped by orchestrator (Leorio reads the comment as informative; nil embedded client already implies a nil-interface panic) aibridged_internal_test.go:82 interceptionRecordingClient comment says "fail loudly" instead of naming the panic R2 Gon P2 No
CRF-12 Nit Open aibridged_internal_test.go:41 Subtest name contains /, splitting one case into two -run levels R2 Gon Yes

Contested and acknowledged

CRF-3 (P3, pool.go:91) - newRecorder takes all of PoolOptions

  • Finding: newRecorder reads only StructuredLogging and DisableContentRecording but takes the whole PoolOptions; proxy mode would pass pool cache settings and read its record policy from Server.poolOptions, and Server.PoolOptions() returns zero values in proxy mode. Proposed narrowing to the two fields or an embedded struct.
  • Author defense: The PR is an extraction; PoolOptions already carries the record policy, so narrowing introduces a new type in a refactor. Server.poolOptions is kept independently of the published pool, so the getter's zero value does not affect the policy a recorder receives. Narrowing is a decision for when a proxy caller exists.
  • Panel closure (R2, 2/2): Ryosuke and Meruem, the same agents that raised it in R1, accepted. At this head the function is unexported with one caller (Acquire) that already holds PoolOptions, so the wider parameter has no effect and narrowing later costs nothing outside coderd/aibridged. Both judged that the proxy-caller concern belongs to the PR that adds the caller. Zoro reported that commit 8788f1e (PR feat: forward bridged routes in AI Gateway proxy mode #30226) already calls newRecorder(..., s.poolOptions, ...) from proxy mode; that is where the concern applies.

Round log

Round 1

Netero: no findings (1 Note). Full panel, focused (Go only): ging-go, ryosuke, pariston, mafuuu, bisky, gon, leorio, mafu-san, wildcard meruem (random draw). ging-go and pariston: no findings.
CRF-1 downgraded from Gon's P2 to P3. Keep-argument: a reader trusts the comment and concludes proxy traffic is recorded under the content policy. Downgrade reason: no proxy traffic is forwarded or recorded at this head (aibridged.go:266 logs "not yet functional"), so the false belief cannot lead to a wrong decision about recorded data; the consequence is a reader searching for a caller that does not exist.
CRF-2 downgraded from Gon's P2 to P3 on the same basis: reader confusion about what the comment guards against, no behavior risk.
Bisky's ordering-assertion Note and Mafu-san's/Leorio's trust-signal Notes not posted (no change requested, no information the author lacks).
Reviewed against 7dc2cf5..bbd6aed.

Round 2

Churn guard: PROCEED (5 addressed, CRF-3 contested). Netero: no findings, verified CRF-1/2/4/5/6 fixes (mutation check on apiKeyID). Fix round (only comments and tests changed; no new files or exported signatures). Panel: ryosuke, meruem (dispute check-in, R1 agents reused via message_agent), bisky, gon, leorio (comments changed), wildcard zoro (random draw). CRF-3 closed 2/2. CRF-10 dropped. Keep-argument: the doc comment duplicates facts in the code and inline comment, so they can drift. Drop reason: Gon and Zoro propose opposite fixes, Leorio verified it accurate, and it follows R1 suggested wording. CRF-11 dropped. Keep-argument: "fail loudly" does not name the panic. Drop reason: "nil embedded client" already tells the reader the failure mode, and Leorio found it informative. 1 new Nit.
Reviewed against 7dc2cf5..a9e175e.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR moves recorder construction from CachedBridgePool.Acquire into newRecorder and adds TestNewRecorder; the recorder chain it builds is unchanged. 4 P3, 1 P4, 1 Nit.

Out of scope (needs a ticket or explicit acceptance by a human):

  • aibridge/api.go:91: no test in aibridge covers the middleware order in NewRecorder, so a reorder there fails only TestNewRecorder in coderd/aibridged.
  • aibridge/recorder/filter_recorder.go:44: FilterRecorder and WithoutRecords have no unit tests; their drop behavior is checked only indirectly.

Notes:

  • pool.go:102: the deleted field comment said the middleware was "resolved once here rather than on every cache miss"; newRecorder now rebuilds it on each cache miss. The cost is negligible next to bridge construction, but the PR description does not mention the change.

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/aibridged/pool.go Resolved
Comment thread coderd/aibridged/pool.go Resolved
Comment thread coderd/aibridged/pool.go Resolved
@pawbana

pawbana commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-review of a9e175e, which rewrites the two newRecorder comments, adds an APIKeyID subtest, and moves test expectations into the table. 1 new Nit.

The two comment findings, the missing apiKeyID assertion, the computed test expectations, and the id rename are fixed; the new subtest fails when a different key is passed to NewDRPCRecorder. The PoolOptions parameter finding is closed (see the reply on that thread).

🤖 This review was automatically generated with Coder Agents.

@pawbana
pawbana force-pushed the pawel/aigov-615-reverse-proxy-handler-with-recorder-lifecycle-and-key-7 branch from 9f6762e to 386352e Compare October 1, 2026 12:13
Base automatically changed from pawel/aigov-615-reverse-proxy-handler-with-recorder-lifecycle-and-key-7 to main October 1, 2026 12:25
@pawbana
pawbana force-pushed the pawel/issue-29726-recorder branch 2 times, most recently from f3a95f4 to e6beea7 Compare October 1, 2026 13:01
@pawbana
pawbana marked this pull request as ready for review October 1, 2026 13:01
@pawbana pawbana changed the title refactor(coderd/aibridged): extract recorder construction chore: extract recorder construction Oct 1, 2026
@pawbana
pawbana requested a review from SasSwart October 1, 2026 13:03
@pawbana
pawbana force-pushed the pawel/issue-29726-recorder branch from e6beea7 to 0e86233 Compare October 1, 2026 13:31
@pawbana
pawbana enabled auto-merge (squash) October 1, 2026 13:43
@pawbana
pawbana merged commit f96d269 into main Oct 2, 2026
29 checks passed
@pawbana
pawbana deleted the pawel/issue-29726-recorder branch October 2, 2026 14:18
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants