Skip to content

fix(file-transfer): avoid repeated directory record encoding - #151987

Merged
vincentkoc merged 1 commit into
mainfrom
perf/file-transfer-encoded-records-m4-20260918
Sep 18, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
perf/file-transfer-encoded-records-m4-20260918

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Large directory listings and fetched-directory summaries repeatedly serialize every previously accepted record while checking the text limit.

User Impact

Directory tools perform fewer record encodings while preserving the 8192-byte wrapped-text limit, exact filenames, pagination, saved files and attachment order. No configuration or migration is required.

Why This Change Was Made

The existing text renderers encode each projected record once and reuse its JSON fragment while assembling candidate summaries. Native JSON encoding still owns escaping and field order; complete-wrapper validation and reserved-marker handling remain unchanged. Candidate assembly and security-wrapper scans still occur.

Evidence

  • The five original listing fixtures encode 345,966 or 346,048 records against a 5,036-record budget. The saved-directory fixture encodes 3,828 against 87. All six fail only after their existing semantic assertions pass.
  • All 55 candidate directory-tool cases pass with zero skips, including those record budgets, exact JSON bytes, pagination, extracted file hashes and image-first attachments.
  • Focused production and test typechecks pass. Independent scoped review found no actionable defects; canonical formatting changes were separately reviewed.
  • Typed lint, line-cap and final-format checks pass. All seven selected native commands settled normally; the qualified source was verified after restoration.
  • These are local behavioral and work-count results. Matched direct-VM stack measurements remain outstanding; no deployment speedup is claimed.

Punchcard-Session: ember-river-harbor-t4

Punchcard-Session: ember-river-harbor-t4
@vincentkoc vincentkoc self-assigned this Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 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.

@vincentkoc
vincentkoc marked this pull request as ready for review September 18, 2026 17:16
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 1:23 PM ET / 17:23 UTC.

ClawSweeper review

What this changes

The file-transfer plugin reuses encoded directory records when building bounded tool responses, with regression checks for encoding work and unchanged output.

Merge readiness

✅ Ready for maintainer review

Keep open: the optimization remains useful on current main, and no introduced correctness or security defect was found. This member-authored PR is also protected from automatic closure.

Priority: P2
Reviewed head: 4e9d86c7a9cff0ac917d99e126480eadf0350165

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with meaningful regression checks and no identified defect; deployment performance remains explicitly unclaimed.
Proof confidence 🌊 off-meta tidepool Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its reported tool-boundary tests exercise both renderers and encoding budgets; they are supplemental validation, not deployment-speedup evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its reported tool-boundary tests exercise both renderers and encoding budgets; they are supplemental validation, not deployment-speedup evidence.
Evidence reviewed 7 items Verified introduced scope: The pinned merge-base-to-head diff changes only the two directory renderers and their tests. Host-verified test-merge evidence preserves base-only changes.
Listing behavior preserved: Native JSON encoding still handles every field; continuation calculation, complete-wrapper validation, reserved-marker rejection, and the 8192-byte limit remain intact.
Saved-file behavior preserved: The changed saved-directory renderer affects only the text projection; extraction, hashes, structured metadata, attachment selection, and filesystem operations are unchanged.
Findings None None.
Security None None.

How this fits together

File-transfer tools receive directory listings or archives from paired nodes and return readable summaries to the agent. These renderers limit summary size while preserving complete filenames, continuation tokens, and saved-file details.

flowchart TD
  A[Agent directory request] --> B[Paired node]
  B --> C[Directory listing or fetched archive]
  C --> D[Encode summary records once]
  D --> E[Validate security wrapper and byte limit]
  E --> F[Bounded agent response]
  C --> G[Complete details and saved files]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -6, Tests +70. Total +64 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 12 18 -6
Tests 2 77 7 +70
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 89 25 +64

Review metrics

None.

Technical review

Best possible solution:

Keep this optimization within the existing renderers, preserving exact output and safety checks without adding configuration or another serialization owner.

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

Yes, for repeated encoding: current main serializes every accepted record again on each candidate iteration. This was verified from source, not a locally executed failure or latency benchmark.

Is this the best way to solve the issue?

Yes. Reusing native JSON fragments removes repeated record encoding at the existing owner while retaining complete-output validation; it does not claim to eliminate candidate assembly or wrapper scanning.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded performance improvement to directory-tool rendering, with no demonstrated urgent user-facing outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its reported tool-boundary tests exercise both renderers and encoding budgets; they are supplemental validation, not deployment-speedup evidence.

Label justifications:

  • P2: This is a bounded performance improvement to directory-tool rendering, with no demonstrated urgent user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its reported tool-boundary tests exercise both renderers and encoding budgets; they are supplemental validation, not deployment-speedup evidence.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc
vincentkoc merged commit 8744037 into main Sep 18, 2026
171 checks passed
@vincentkoc
vincentkoc deleted the perf/file-transfer-encoded-records-m4-20260918 branch September 18, 2026 17:33
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
* origin/main:
  test(gateway): isolate session resolution channel fixtures (#151945)
  fix(clickclack): drain discussion opens before shutdown (#151978)
  fix(test): restore trusted packaging harness startup (#151967)
  improve(codex): batch session adoption binding reads (#151979)
  improve(cron): reduce allocations for busy stream sources (#151956)
  fix(file-transfer): avoid repeated directory record encoding (#151987)
  fix: avoid session-list rebuilds when authentication availability changes (#151920)
  fix(updates): explain externally managed update refusals (#151942)
  improve(heartbeat): avoid unused config work in membership checks (#151867)
  fix(android): keep status text readable and label accessibility actions (#151342)
  improve(ui): show OS and size in the environment selector (#151947)
  fix(android): keep tool errors visible in collapsed chat activity (#151332)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. plugin: file-transfer rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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