Repository navigation
improve(googlechat): avoid duplicate DM route reads - #128359
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 4:47 PM ET / 20:47 UTC. ClawSweeper reviewWhat this changesThis PR lets Google Chat outbound session routing reuse direct-message Space metadata to avoid a redundant provider read before delivery. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. Current main still performs the direct-message lookup followed by a second space read; this branch reuses the already-returned Space only for route classification while preserving the public string resolver and fallback read. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherThe Google Chat plugin resolves an outbound target into a session route before the generic channel layer delivers a message. That route supplies direct/group classification and the canonical peer identity used by downstream session handling. flowchart LR
A[Outbound target] --> B[Google Chat target resolver]
B --> C[Direct-message Space lookup]
C --> D[Session route classification]
D --> E[Channel session route]
E --> F[Outbound delivery]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +14, Tests +65. Total +79 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the private metadata-carrying resolver, retain fallback classification for explicit or unclassified spaces, and land with the focused route test protecting the one-read invariant. Do we have a high-confidence way to reproduce the issue? Yes, from current source: a users/* route performs findDirectMessage and then getGoogleChatSpace before classification. The focused regression test gives a deterministic one-versus-two-read path, although this read-only review did not execute it. Is this the best way to solve the issue? Yes. Reusing the response at the producer is the narrowest fix; caching or changing send-boundary resolution would broaden behavior without addressing the discarded route-classification metadata. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e4bf24246170. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready at exact head ClawSweeper before-merge dispositions:
Two review-report clarifications:
Verification:
No actionable correctness, security, compatibility, or process item remains. |
|
Merged via squash.
|
Co-authored-by: Amp <[email protected]>
What Problem This Solves
Fixes an issue where ordinary Google Chat direct-message sends performed a redundant space lookup while preparing the outbound session route. Resolving a user target already returns the full direct-message
Space, but routing discarded that metadata and immediately fetched the same space again only to classify it.Why This Change Was Made
The private target resolver now carries the provider-returned
Spacealongside its canonical name so session routing can reuse its type metadata. Explicit space targets and missing or unclassified metadata retain the existingspaces.getfallback; the exported string resolver and the separate send-boundary user-to-space resolution are unchanged.No cache, retry, idempotency, config, protocol, security, storage, or public SDK behavior changes. AI-assisted implementation and verification.
User Impact
Direct-message session routing uses one provider read instead of two before delivery, reducing route preparation latency and Google Chat API traffic. Message text, cards, thread projection, route identity, and error behavior remain unchanged.
Evidence
expected vi.fn() to be called once, but got 2 times; it passes with one exactspaces:findDirectMessagerequest after the change.node scripts/check-changed.mjs -- extensions/googlechat/src/targets.ts extensions/googlechat/src/targets.outbound-session.test.tspassed (format, production/test typechecks, type-aware lint with 0 findings, dead exports, boundaries, guards, and import cycles).git diff --checkpassed.gpt-5.6-sol/ high reported no actionable findings andpatch is correctat 0.99 confidence.