fix(ios): scope session mutations to selected agent#103415
Conversation
a7c3811 to
522df62
Compare
|
@clawsweeper re-review Rebased onto current |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 9:06 AM ET / 13:06 UTC. Summary PR surface: Docs +1, Other +86. Total +87 across 3 files. Reproducibility: yes. at source level: the previous iOS mutation methods bypassed selected-agent normalization, and the Gateway contracts show those raw targets resolve differently from adjacent chat operations. A failing connected-device run was not performed. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep this canonical resolver-based implementation, then demonstrate on a redacted connected iOS simulator or device that patch, delete, and fork affect the selected-agent session before merging. Do we have a high-confidence way to reproduce the issue? Yes at source level: the previous iOS mutation methods bypassed selected-agent normalization, and the Gateway contracts show those raw targets resolve differently from adjacent chat operations. A failing connected-device run was not performed. Is this the best way to solve the issue? Yes. Reusing the canonical session target resolver removes duplicate routing policy, and deriving fork child ownership from the normalized parent matches the server create contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5a451f92f993. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Docs +1, Other +86. Total +87 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
Found and fixed one remaining contract bug before landing: Focused proof on head
Final exact-head landing proof on
The changelog credits both the PR author and issue reporter. The simulator regression validates the real transport methods and captured Gateway payloads; no connected production Gateway or destructive session mutation was used. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
59b54a0 to
c2262aa
Compare
c2262aa to
7977196
Compare
|
Merged via squash.
|
|
Post-merge live proof is green on current Scenario:
Proof command shape: This closes the earlier proof gap: the scoped routing behavior has now traversed the production Swift WebSocket and Gateway session-store paths end to end. |
* fix(ios): scope session mutations to selected agent * fix(ios): preserve agent ownership for session mutations --------- Co-authored-by: lin-hongkuan <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Summary
globalagent routing and already-scopedagent:*keys.Issue / Motivation
Fixes #103366.
When the iOS client selected an agent and held an unscoped session key, chat operations targeted
agent:<selected>:<key>, but patch/delete/fork sent the raw key. Those mutations could therefore address a different session; delete also requests transcript deletion.Changes
patchSession,deleteSession, andforkSessionthroughsessionTarget(for:).global, and already-scoped session keys across all three operations.Testing
git diff --check— passed.gitleaks dir --no-banner --redact apps/ios/Sources/Chat/IOSGatewayChatTransport.swift— no leaks found.gitleaks dir --no-banner --redact apps/ios/Tests/IOSGatewayChatTransportTests.swift— no leaks found.What Problem This Solves
It makes destructive and state-changing session mutations address the same selected-agent session that the iOS chat pane is actually using. For an unscoped
scratchkey with selected agentops, all three mutations now targetagent:ops:scratchrather than rawscratch.Evidence
The new regression test captures the actual dispatched requests for patch, delete, and fork and checks:
agent:reviewer:<key>with no redundantagentId;globalremainsglobalwithagentId: reviewer;agent:ops:mainremains unchanged;Repository hygiene checks passed as listed above. Runtime behavior is unchanged when no selected agent is set.