Repository navigation
fix: keep archived usage path resolution asynchronous - #200461
Conversation
Share containment and fallback policy across sync and async path resolvers. Preserve lexical normalization before following symlinks. Co-authored-by: RomneyDa <[email protected]>
|
🦞👀 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 changes before merge. What this changesThis PR shares transcript path policy between synchronous and asynchronous filesystem probes and switches archived usage reads to the asynchronous resolver. Example: Read usage from /state/agents/main/sessions/record.jsonl.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this PR open: it addresses a current synchronous-filesystem path, but the async replacement changes resolution for symlink targets containing parent segments. Priority: P2 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherGateway usage readers turn session identifiers and stored transcript filenames into ordered filesystem candidates, then stream the selected transcript into a usage accumulator. flowchart TD
A[Archived usage request] --> B[Usage reader]
B --> C[Candidate planner]
C --> D[Shared path policy]
D --> E[Async filesystem probes]
E --> F[Transcript stream]
F --> G[Usage snapshot]
Technical reviewBest possible solution: Keep the shared path-policy owner, but make its asynchronous canonicalization preserve ordinary symlink-expansion semantics before switching usage reads. Do we have a high-confidence way to reproduce the issue? Current-main source directly exposes synchronous canonicalization beneath the asynchronous usage reader, and the existing filesystem-observation regression targets that path; no target code was executed during this read-only review. Is this the best way to solve the issue? Sharing candidate ordering and containment policy is appropriate, but native asynchronous realpath does not fully preserve the existing ordinary-resolution contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 22d5c8735a84. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +113, Tests +70. Total +183 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 17, 2026, 2:04 AM ET / 07:04 UTC. |
Share containment and fallback policy across sync and async path resolvers. Preserve lexical normalization before following symlinks. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 4c79d8f)
* fix: preserve archived transcript symlink selection Restore the ordinary fs-safe path semantics lost in #200461 without moving filesystem work back onto the caller. Reuse the existing realpath worker; cover indirect links and actual usage totals. Co-authored-by: RomneyDa <[email protected]> * fix(sessions): isolate asynchronous transcript path dependencies Keep the shared path policy in the synchronous module and move worker-backed I/O to its async entry point. This removes the CI import cycle and wrapper source dependency without lazy-load synchronous filesystem work. Correct the parameterized test context typing. Co-authored-by: RomneyDa <[email protected]> --------- Co-authored-by: RomneyDa <[email protected]>
* fix: preserve archived transcript symlink selection Restore the ordinary fs-safe path semantics lost in #200461 without moving filesystem work back onto the caller. Reuse the existing realpath worker; cover indirect links and actual usage totals. Co-authored-by: RomneyDa <[email protected]> * fix(sessions): isolate asynchronous transcript path dependencies Keep the shared path policy in the synchronous module and move worker-backed I/O to its async entry point. This removes the CI import cycle and wrapper source dependency without lazy-load synchronous filesystem work. Correct the parameterized test context typing. Co-authored-by: RomneyDa <[email protected]> --------- Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 62bb5d3)
Share containment and fallback policy across sync and async path resolvers. Preserve lexical normalization before following symlinks. Co-authored-by: RomneyDa <[email protected]>
* fix: preserve archived transcript symlink selection Restore the ordinary fs-safe path semantics lost in openclaw#200461 without moving filesystem work back onto the caller. Reuse the existing realpath worker; cover indirect links and actual usage totals. Co-authored-by: RomneyDa <[email protected]> * fix(sessions): isolate asynchronous transcript path dependencies Keep the shared path policy in the synchronous module and move worker-backed I/O to its async entry point. This removes the CI import cycle and wrapper source dependency without lazy-load synchronous filesystem work. Correct the parameterized test context typing. Co-authored-by: RomneyDa <[email protected]> --------- Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Reading archived transcript usage uses an async API, but resolving the transcript filename still performs synchronous filesystem calls on the Gateway thread. The existing zero-sync-filesystem regression reproduces this on main.
User Impact
Archived usage reads no longer block the Gateway thread during transcript path resolution. Candidate ordering, restored-root and sibling-agent fallback, and existing synchronous callers retain their current behavior. No configuration or migration is required.
Why This Change Was Made
One shared path policy now accepts synchronous or asynchronous filesystem probes, rather than maintaining two containment implementations. Transcript candidate planning is likewise shared. The async usage reader selects the async resolver.
Compatibility review also found that native async realpath handles a symlink followed by a parent segment differently from the existing resolver. Normalize the input before resolving it and retain a regression proving sync/async agreement.
Evidence