Repository navigation
fix(history): keep canonical transcript owners distinct - #164512
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 9:36 AM ET / 13:36 UTC (Revision 12). ClawSweeper reviewWhat this changesThe PR keeps literal global and unknown transcript owners distinct from agent-qualified conversations and adds history-read regressions while preserving legacy aliases. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main, and no introduced correctness defect was found. The updated evidence addresses the previous review’s candidate-validation request; ordinary CI gates still apply. Priority: P2 Review scores
Verification
How this fits togetherGateway history requests select a conversation and read its transcript through SQLite workers. Transcript ownership and current sharing permissions determine whether the requested messages can be returned. flowchart TD
A[History request and message anchor] --> B[Select canonical conversation]
B --> C[Read stored transcript owner]
C --> D[Compare distinct conversation identities]
D -->|Mismatch or missing binding| E[Reject request]
D -->|Match| F[Read history and recheck sharing]
F --> G[Return authorized messages]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +3, Tests +159. Total +162 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep transcript ownership checks aligned with canonical conversation identity while retaining supported legacy aliases and current sharing revalidation. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: request an anchored transcript under the agent-qualified counterpart of its literal global or unknown owner. Current main scopes both identities to the same value; the PR records a failing baseline regression. Is this the best way to solve the issue? Yes, the patch narrowly fixes the owning comparison, preserves the shared alias resolver, and checks matching, mismatched, missing, and retained-history cases. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 390b413d462e. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
091c63b to
fef576b
Compare
c8f6ac7 to
1f00cf7
Compare
What Problem This Solves
Anchored history requests could pass the transcript-owner check when the stored owner was literal
globalorunknownand the requested owner wasagent:research:globaloragent:research:unknown. Scoping both sides as legacy aliases collapsed distinct stored conversations.User Impact
History now preserves canonical literal owners and compares the resolved owner with the selected canonical key. Matching reads still succeed; mismatched ownership returns
INVALID_REQUEST. Existing retained legacy-key resolution remains supported, including padded aliases. Persisted formats and update behavior are unchanged; no migration is required.Why This Change Was Made
The fix uses the existing alias resolver only where appropriate and preserves the missing-binding refusal. The regression covers both sentinel names, correct and incorrect anchors, a missing binding, and retained legacy keys. The original global-versus-main case moves into the focused ownership test so the existing handler file stays below its growth cap.
Production +10 / -7 / net +3. This PR contains no Doctor retained-node migration, lifecycle/snapshot extension, or dependency on #163592. The retained-node runtime handling stays in place.
Evidence
Candidate:
f57186bd379a06abc07945207e6ae18498419b30; base:82adb7a49d36e844e4ea1989bc5d865abac916f0. Codex autoreview is clean through P2, including exact classification of padded legacy keys. Formatting andgit diff --checkpass.On Hetzner lease
cbx_b2c1c013d4d4, baseline runrun_bed524967d5d8711a34ab7173a9db159reproduced the wrong-owner response on clean main with the new regression (43.470 s). The retained legacy-key control passed in the same run. The original run remains failed as expected, with no retry or relaxed assertion.Native run
run_f3bce8134207521d36cbedfa1d8ff42fpassed the behavioral checks at production-equivalent parent1f00cf7aeae5ce7053777d45504fb1b9b99d3703:src/gateway/server-methods/chat-history-ownership.test.tssrc/gateway/server-methods/chat-history-handler.test.tssrc/gateway/server-methods/chat-history-retained-sharing.test.tsThese tests use real SQLite admission/history workers and the registered handlers; a mocked helper cannot establish the owner and retained-data contract. They do not boot a Gateway per case. Wall cost includes worker artifact preparation. Targeted lint and the line-cap ratchet passed. Production accounting uses every GitHub file page (3 files). The only subsequent change adds two constant-tuple annotations to the test data. It fixes three
noUncheckedIndexedAccesstype errors reported by prior CI37205481093, without changing production code, test values, or assertions. Fresh native runrun_fa6cac006b87430a8cc28848423bf000passed the exact failingtest/tsconfig/tsconfig.core.test.gateway-methods.jsongraph and test lint at the final head. Both reviews are clean through P2. Final-head hosted CI 37206404598 passed: 421 seconds elapsed and 6,049 summed job-seconds including setup. The earlier CI failure remains attributed to its original head. Merged as0e728fb660c08611443d060a956efb66155df1a1, verified onorigin/main. No local build or test ran.