Skip to content

fix(runtime): honor refresh and retry in files write - #904

Open
RedZapdos123 wants to merge 1 commit into
openkruise:masterfrom
RedZapdos123:fix-runtime-files-write-refresh-retry
Open

fix(runtime): honor refresh and retry in files write#904
RedZapdos123 wants to merge 1 commit into
openkruise:masterfrom
RedZapdos123:fix-runtime-files-write-refresh-retry

Conversation

@RedZapdos123

@RedZapdos123 RedZapdos123 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description:

Honor runtime refresh and retry in the multipart files write path.

Before this change, FilesystemAPI.Write resolved transport once from the bound sandbox and sent a single multipart /files request. As a result, a caller-provided WithRefresh hook could not surface a newly stamped runtime URL or TLS transport, and transient transport or HTTP 5xx failures ignored the configured WithRetry policy.

This PR keeps the existing outward /files error behavior, but refreshes the sandbox before each attempt, rebuilds the request from a cached multipart payload, and adds regression tests for the missing-runtime-URL refresh path and a transient 500 response.

Validation Tests run:

  • go test ./pkg/utils/runtime -run 'TestWriteFileWithRuntime_RefreshResolvesRuntimeURL|TestWriteFileWithRuntime_RetriesTransientServerError' -count=1 -v
  • go test ./pkg/utils/runtime -run 'TestWriteFileWithRuntime_(InputValidation|HTTPInteractions|TransportError|HonorsLargeArgsTimeout|RefreshResolvesRuntimeURL|RetriesTransientServerError)|TestTLSMode_CapabilityGroupsUseRuntimeTLS|TestTLSMode_CapabilityGroupsRejectInvalidBundle' -count=1

Notes:

  • Scope is intentionally limited to FilesystemAPI.Write.
  • ListDir and Remove are left for a follow up PR if needed.

@kruise-bot
kruise-bot requested review from AiRanthem and zmberg August 31, 2026 05:48
@kruise-bot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign furykerry for approval by writing /assign @furykerry in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.11688% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.55%. Comparing base (815a36d) to head (6227fc9).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
pkg/utils/runtime/filesystem.go 83.11% 9 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #904      +/-   ##
==========================================
+ Coverage   82.49%   82.55%   +0.06%     
==========================================
  Files         254      254              
  Lines       21585    21645      +60     
==========================================
+ Hits        17806    17869      +63     
+ Misses       3080     3076       -4     
- Partials      699      700       +1     
Flag Coverage Δ
unittests 82.55% <83.11%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Apply refresh/retry to the multipart /files path and keep context timeout errors visible instead of swallowing them inside the retry loop.

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
@RedZapdos123
RedZapdos123 force-pushed the fix-runtime-files-write-refresh-retry branch from d72b9b2 to 6227fc9 Compare August 31, 2026 11:09
@RedZapdos123

Copy link
Copy Markdown
Contributor Author

I think the current CI test failure is related to #791.

@RedZapdos123

Copy link
Copy Markdown
Contributor Author

This E2E failure is separate from this PR.

sandbox (with sandbox-gateway) failed during quota pool startup: quota-small stayed 1/2 Running and AVAILABLE=0 before this PR's FilesystemAPI.Write path ran.

Tracked the issue in #908. Created the PR: #909 which adds a liveness probe so failed Code Interpreter startup restarts instead of remaining permanently unready.

The CI job lacks sandbox logs so the exact startup error is not proven there. Local reproduction matches this pod state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants