Introduce kubectl and kubeconfig overrides#365
Conversation
|
|
||
| setPathValidation({ status: "validating", value: trimmedPath, message: null }); | ||
| try { | ||
| await validateK8sPath(trimmedPath, kind); |
There was a problem hiding this comment.
WARNING: Stale async validation can overwrite current path validation state
validateAdvancedPath does not cancel or ignore in-flight validateK8sPath calls. If the user edits a path while a previous validation is still pending, the older promise can resolve last and overwrite the validation state with an out-of-date value/status.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| try { | ||
| await validateK8sPath(trimmedPath, kind); | ||
| setPathValidation({ status: "valid", value: trimmedPath, message: null }); | ||
| setValidationError(null); |
There was a problem hiding this comment.
WARNING: Successful path validation clears unrelated form errors
Calling setValidationError(null) here clears any higher-level validation error (e.g., missing name) while the user is still editing the form.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| try { | ||
| setNamespaces(await getK8sNamespaces(context)); | ||
| } catch { | ||
| setNamespaces(await getK8sNamespaces(context, getCommandOptions())); |
There was a problem hiding this comment.
WARNING: Discovery effect has no cancellation guard
The namespace-loading effect starts an async request without a cancellation/ignore flag. When applyAdvancedPaths resets the dropdowns after a path change, an in-flight request can still resolve and repopulate namespaces with stale data.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| setDiscoveryError(null); | ||
| }; | ||
|
|
||
| const applyAdvancedPaths = useCallback(() => { |
There was a problem hiding this comment.
WARNING: applyAdvancedPaths leaves the old port selected
When kubectl/kubeconfig paths change, this function resets context, namespace, and resourceName but leaves port and isPortOverridden untouched. After re-selecting a new resource, the previously chosen port can be saved for the wrong resource.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
|
|
||
| setPathValidation({ status: "validating", value: trimmedPath, message: null }); | ||
| try { | ||
| await validateK8sPath(trimmedPath, kind); |
There was a problem hiding this comment.
WARNING: Stale async validation can overwrite current path validation state
validateK8sAdvancedPath does not cancel or sequence in-flight validateK8sPath calls. A slower, stale validation result can finish last and display the wrong validity icon/message for the current input.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| ); | ||
|
|
||
| // ── K8s cascading dropdown loading ── | ||
| useEffect(() => { |
There was a problem hiding this comment.
WARNING: Duplicate K8s context fetch on modal open
This effect and the init effect at line 889 both call getK8sContexts when the modal opens. Because the init effect sets saved kubectl/kubeconfig paths asynchronously, the first fetch uses stale k8sCommandOptions and a second fetch with the correct options follows, causing duplicate requests and a potential spurious discovery error.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
|
|
||
| useEffect(() => { | ||
| if (formData.k8s_context) { | ||
| loadK8sNamespacesList(formData.k8s_context); |
There was a problem hiding this comment.
WARNING: Discovery effect has no cancellation guard
The namespace-loading effect starts an async request without a cancellation/ignore flag. Rapid context switches can leave a stale namespace list on screen if an earlier request resolves after a later one.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| ); | ||
| } else { | ||
| setK8sResources([]); | ||
| } |
There was a problem hiding this comment.
WARNING: Discovery effect has no cancellation guard
The resource-loading effect starts an async request without a cancellation/ignore flag. Rapid context/namespace/type changes can leave a stale resource list on screen if an earlier request resolves after a later one.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summaries (2 snapshots, latest commit 0d7e4c3)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 0d7e4c3)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
Files Reviewed (6 files)
Fix these issues in Kilo Cloud Previous review (commit f48590c)Status: 8 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (20 files)
Reviewed by kimi-k2.7-code · Input: 48.6K · Output: 7.7K · Cached: 440.8K |
| return run(kind, async (isLatest) => { | ||
| try { | ||
| await validateK8sPath(trimmedPath, kind); | ||
| if (isLatest) { |
There was a problem hiding this comment.
CRITICAL: isLatest guard is bypassed because it is not invoked
useLatestAsync passes isLatest as a function () => boolean. Checking it as a truthy value (if (isLatest)) is always true, so stale validateK8sPath results can still overwrite the current path validation state and call applyAdvancedPaths. The same bug occurs on lines 451 and 456.
| if (isLatest) { | |
| if (isLatest()) { |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| return run(kind, async (isLatest) => { | ||
| try { | ||
| await validateK8sPath(trimmedPath, kind); | ||
| if (isLatest) { |
There was a problem hiding this comment.
CRITICAL: isLatest guard is bypassed because it is not invoked
useLatestAsync passes isLatest as a function () => boolean. Checking it as a truthy value (if (isLatest)) is always true, so stale validateK8sPath results can still overwrite the current path validation state and call applyK8sAdvancedFields. The same bug occurs on lines 670 and 675.
| if (isLatest) { | |
| if (isLatest()) { |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
* feat: add rowsToCSVWithHeaders function to include headers in CSV output * feat: enhance copy functionality to include headers in CSV output * feat: enhance copy functionality to handle errors and include headers in clipboard output * feat: add option to toggle CSV headers when copying Add a csvIncludeHeaders setting (persisted in config.json) and a toolbar toggle in the copy controls to choose whether copied CSV output includes the column header row. Defaults to true. Threaded through MultiResultPanel, StackedResultItem and ResultEntryContent down to DataGrid, with i18n keys added across all 8 locales. --------- Co-authored-by: Andrea Debernardi <andrea@debbaweb.it>
0d7e4c3 to
4331d0a
Compare
|
@kilocode-bot please review the new changes. |
|
To use Kilo from GitHub you first need to link your GitHub account to Kilo. Link your Kilo account to continue. After linking, mention me again in this issue or pull request. |
Overview
Adds the ability to override the kubectl binary path and KUBECONFIG file per
Kubernetes connection, plus on-blur validation of those paths in both the K8s
connections modal and the new-connection modal's inline K8s flow.
What's new
Backend (Rust)
kubectl_path/kubeconfig_pathonK8sConnectionandK8sConnectionInputmodels, persisted tok8s_connections.json.K8sCommandOptionsplumbing through the tunnel, discovery commands (contexts,namespaces, resources, resource ports), connection test, and MCP connection
expansion — so overrides take effect for port-forward tunnels and the cascading
discovery dropdowns.
validate_k8s_path_cmdthat validates:kubectl: the path exists, is a file, and is executable (resolves bare nameslike kubectl via
PATH, honorsPATHEXTon Windows).kubeconfig: the path exists and is a file.kubectl_commandnow preflight-validates explicit overrides before spawning kubectl,giving clear errors instead of cryptic spawn failures.
~expansion andPATHlookup.Frontend (TS/React)
K8sConnectionsModalandNewConnectionModal(inline K8s) with kubectl Path and Kubeconfig Path inputs.valid, red border + error message when invalid.
kubectl/kubeconfig paths change, and Save/Test are blocked until paths are valid
(with a prompt to re-select context/namespace/resource when paths change).
validateK8sPathutility +K8sCommandOptionsthreaded through all K8s discovery/testcalls.
i18n
validation/reset messages) across all 8 locales (en, it, de, es, fr, ja, ru, zh).
Tests
k8s_tunnel/tests.rsper project Rustrules): empty paths valid, missing file, directory rejected,
executable/non-executable file, Windows/Unix handling.
validateK8sPathinvoke contract; updatedNewConnectionModaltestfor the added
k8sCommandOptionsarg.Provides native tooling for resolving issues like #323.