Skip to content

fix: preserve archived transcript symlink selection - #200505

Merged
RomneyDa merged 2 commits into
mainfrom
fix/transcript-ordinary-realpath
Nov 17, 2026
Merged

RomneyDa merged 2 commits into
mainfrom
fix/transcript-ordinary-realpath

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Archived usage reads can select another agent's transcript when a saved transcript path contains an indirect symlink whose target includes ... The async resolver introduced in #200461 follows native symlink semantics, unlike the previous ordinary resolver. This addresses the concrete P2 reported on that PR; the finding was not resolved before merge.

User Impact

Restores the prior transcript selection and usage totals while keeping filesystem canonicalization off the caller's thread. No configuration, authorization, retention, or database-policy changes. The separate xAI session-authorization repair is #200510.

Why This Change Was Made

Reuse safeRealpathSync, the existing canonicalization contract, inside the existing realpath worker. Ordinary resolution normalizes parent segments within each expanded symlink before following other links; native realpath can select a different file. The existing executable-resolution operation retains its physical-path behavior. The tradeoff is worker dispatch for async transcript canonicalization.

The asynchronous adapter now has its own paths-async.ts entry point. Synchronous path callers retain the existing lightweight module, while both adapters consume the same path-policy generator. This removes the static import cycle and keeps execution-worker dependencies out of the PR wrapper's source closure. A lazy-import attempt was rejected because the unchanged no-sync assertion caught a cold statSync; there is no prewarming, runtime-recovery change, authority-type extraction, new pool, or custom path walker. The parameterized filesystem test uses test.for so its skip context is typed correctly.

Evidence

  • Deterministic regression is red on the merged implementation: expected agents/main/sessions/record.jsonl, received agents/worker/sessions/record.jsonl; the synchronous resolver selects the expected file.
  • Original repair proof: 93 Node tests and 88 pinned-Bun tests.
  • Final adapter correction: 67 pinned-Bun checks pass (24 wrapper/source-closure, 31 archived-usage/filesystem, 12 path-policy); 43 Node path/filesystem checks pass. All four caller no-sync usage modes, including indirect symlinks, pass without changing their assertions.
  • Final correction passes type-aware lint, format, the exact formerly failing Gateway test-type leaf, core types with the canonical 12 GiB heap, and full architecture checks, including zero runtime and static import cycles.
  • Final native PR provisioning suite passes: 16 passed, 3 skipped. Both wrapper source-closure checks pass without adding execution-worker files to the wrapper inventory. Hosted CI on the corrected head remains required.
  • POSIX symlink cases are explicitly skipped on Windows. Real-filesystem archived-usage integration is not claimed as a live Gateway RPC demonstration.

The CI failures on the original PR head are retained as regression evidence, not dismissed as flakes. No guard, assertion, dependency version, or shared installation was weakened to obtain the corrected results.

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]>
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Nov 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR restores ordinary symlink resolution for asynchronous archived-transcript reads using the existing realpath worker.

Example: main/sessions/alias.jsonl targets link/../record.jsonl, and link targets worker/sessions/child.

  • Before: Archived usage selects worker/sessions/record.jsonl.
  • After: Archived usage selects main/sessions/record.jsonl, matching the synchronous resolver.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused implementation appears correct and has useful integration coverage, but supplied evidence does not satisfy the shipped-behavior proof requirement.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Archived usage can report another transcript's totals when a saved path contains an indirect symlink with parent segments.
Reason: The maintainer-authored direction restores an evidenced existing contract without adding configuration, storage, or authorization policy.

Regression provenance

Regression provenance — verified: source commit 4c79d8f41631 by Dallin Romney; canonical PR #200461 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs a current-main transcript-selection regression, and source review found no introduced correctness defect.

Priority: P2
Reviewed head: fd587d3908a2c3892c6e5d0c67fe4a891eb8acbc

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted Gateway-entry-point output or logs for the indirect-symlink layout showing the intended transcript's usage totals and no synchronous caller-thread path probes; remove IPs, keys, phone numbers, and non-public endpoints.
Agent review details

How this fits together

The archived-usage reader converts a saved transcript filename into filesystem candidates, streams the selected file, and returns aggregated usage.

flowchart TD
A[Archived usage request] --> B[Transcript candidate planner]
B --> C[Shared session path policy]
C --> D[Existing realpath worker]
D --> E[Ordinary filesystem resolver]
E --> F[Selected transcript]
F --> G[Usage accumulator]
Loading

Technical review

Best possible solution:

Run the existing ordinary canonicalization contract in the existing worker so archived usage matches synchronous transcript selection without blocking the caller.

Do we have a high-confidence way to reproduce the issue?

Current-main source, the pinned dependency contract, and the concrete competing-transcript fixture establish the failure path; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch restores the established resolver through an existing worker owner, preserves executable semantics, and avoids a custom path walker or additional pool.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4c61c20fb1a7.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Dallin Romney: Raw commit 4c79d8f adds src/config/sessions/paths.ts:146 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4c79d8f41631; files: src/config/sessions/paths.ts)
  • Peter Steinberger: Raw commit c425156 adds src/infra/exec-realpath-worker.ts:11 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c42515649217; files: src/infra/exec-realpath-worker.ts)

PR surface

Source +22, Tests +43. Total +65 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 31 9 +22
Tests 2 47 4 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 78 13 +65

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: An existing indirect-symlink layout can produce usage totals from the wrong transcript, with limited blast radius and no demonstrated widespread outage.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: An existing indirect-symlink layout can produce usage totals from the wrong transcript, with limited blast radius and no demonstrated widespread outage.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 17, 2026, 3:52 AM ET / 08:52 UTC.

@RomneyDa
RomneyDa marked this pull request as ready for review November 17, 2026 08:58
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]>
@RomneyDa
RomneyDa enabled auto-merge (squash) November 17, 2026 09:22
@RomneyDa
RomneyDa disabled auto-merge November 17, 2026 09:41
@RomneyDa
RomneyDa merged commit 62bb5d3 into main Nov 17, 2026
131 of 133 checks passed
@RomneyDa
RomneyDa deleted the fix/transcript-ordinary-realpath branch November 17, 2026 09:41
RomneyDa added a commit that referenced this pull request Nov 17, 2026
* 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)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant