Repository navigation
fix: map local runtime paths without rewriting host paths - #941
Conversation
Signed-off-by: Afloat <ShuffleMonkey@163.com>
Keep both CHANGELOG entries; preserve the original contribution's source and tests. Signed-off-by: Afloat <ShuffleMonkey@163.com>
chrisknvidia
left a comment
There was a problem hiding this comment.
I reproduced the double rewrite on main with a run directory whose path contains /workspace/, /logs/ and /tests/ components: a plain cd /workspace && ls /logs/artifacts came out as a long nonsense path, quoted and KEY=/--flag= forms were mangled the same way, and _resolve_path mapped an already-local working directory back into the virtual workspace when the run lives under a literal /workspace. At head every one of those cases maps once, rewriting the rewritten command again is a no-op, host paths under the run directory, the runtime root and the interpreter's bin dir pass through untouched, $HOME/workspace/x, ./workspace, URLs and /workspace-other are left alone, and commands with no mappable paths are byte-identical to main. Single, double and backslash quoting and the KEY=/path and --flag=/path spellings behave as before, and the containment checks still reject escapes from the run directory.
Both test files pass at head. With the head test files on main's source the two new tests fail, and so do seven existing artifact, log and verifier tests, purely because the fixture's trial path now contains those components, which is a good way to make the existing suite cover this. Clean main has no failures in either file, so nothing regressed.
One behaviour change beyond the title, inline: a path glued to a short option (-I/workspace/include, -C/workspace, -o/logs/agent/x) is no longer rewritten. Not blocking, but it should be a deliberate choice and in the release note.
The branch conflicts with main in CHANGELOG.md only (Unreleased > Fixed); the source merges cleanly with main, #937 and #938, so a rebase should be quick.
One more inline: the host-first _resolve_path hunk has no test that fails without it (with only that hunk reverted both files stay green); a filesystem-free unit test with roots under a literal /workspace/ci/run passes here and fails on main, so it is cheap to pin. Fuzzing about 3,500 commands over seven run-directory shapes gave 1,600 cases main got wrong and head gets right, no new double rewrites, and the glued short-option form as the only regression.
Recognize alphabetic short options at shell-token boundaries while preserving host paths, URLs, and relative path suffixes. Extend quoting and mapping-order coverage and pin host-first resolution under a literal /workspace run root without creating that directory. Merge current main and retain both release notes. Signed-off-by: Afloat <ShuffleMonkey@163.com>
|
Addressed both points in
The 32 focused tests, lint, formatting, wheel/sdist build and size guard pass. The two existing path-boundary failures and the full-suite Could you approve the seven new workflows and re-review the two fixes? |
rng1995
left a comment
There was a problem hiding this comment.
[SkillEvaluator Review]
Thanks @Afloat16 for this contribution.
Value and readiness: Corrects repeated rewriting of local runtime paths and preserves host paths, quoted paths, attached short options, and containment. New regressions reproduce failures against current-main source. No confirmed findings remain; ready for final review by the maintainers and PIC once current-head CI is green.
Prior findings: 2 of 2 prior concerns verified fixed: attached short-option paths and the literal /workspace host-root regression. Their threads were already resolved.
Material findings: none; all earlier findings verified fixed.
PIC tradeoffs: none.
Verification and gaps: Read the full delta and path/containment call paths, checked simultaneous longest-root substitution, idempotence, shell boundaries and quoting, host-first resolution, traversal rejection, compatibility, CHANGELOG and DCO. Complete local environment/mode suites: 388 passed, 1 skipped, 6 deselected. New regression selection against main: 17 failed, 15 passed as expected. Repository-wide Ruff and whitespace checks passed. Static execution-safety triage passed and fork workflows were authorized. CI is pending. No live agent/provider/container run or full repository test run was performed.
Reviewed head: 00f4ebe53930b4b739fda336fd65f1062827a6e5
|
@Afloat16 - Please give me permissions to merge all your PRs. |
Retain the pull request contribution and current upstream changes. Resolve the CHANGELOG conflict by preserving both sets of entries. Signed-off-by: Afloat <ShuffleMonkey@163.com>
|
Yes @rng1995, please go ahead and merge my PRs once their current required checks pass. All 14 branches (#905, #906, #907, #908, #909, #910, #911, #913, #914, #916, #921, #922, #940 and #941) now include main The #922 source conflict retains both the new planted-canary normalization and the versioned metadata identity. Its permission regression passes with and without planted canaries. The new-head workflows are awaiting approval; the required checks have not run on these heads yet. Please approve the current runs, including this PR's CI, and merge when the required checks pass. I can push any further requested branch edits directly. |
chrisknvidia
left a comment
There was a problem hiding this comment.
Re-checked 00f4ebe on top of the main merge: attached short-option paths are rewritten again (with negative cases for URL, prefix and ./ spellings), and the host-root branch of _resolve_path now has a test that pins it. tests/test_harbor_local_environment.py passes at this head with Harbor 0.27 (89). Nothing open from my side.
Current integration update
Source:
02eb256105db493a76193874a184697d8cf58ba7; main:38cb609a36cb02360c2e737eb6ce2d982be860a5. Merged main and preserved upstream changes; only the CHANGELOG conflict needed manual resolution.Validation on this source: The local environment/mode modules reported 385 passed, 3 skipped, 6 deselected, and 2 failures. Both failing absolute
/workspacedownload cases reproduce on unmodified main with the same FileNotFoundError before their expected containment error. Repository Ruff checks and whitespace checks passed. The earlier results below apply to their recorded revisions; current-head CI must be evaluated separately.Original contribution and validation before this integration update
Summary
Local evaluation breaks when the host run directory shares a virtual path component such as
/workspace: a translated host path can be mapped a second time, changing artifact, working-directory or interpreter locations.Map only original command text, prefer the longest matching root, retain shell quoting and preserve known host run/runtime/interpreter paths. Resolve an already-local working directory before considering virtual aliases, with containment checks intact. URLs, relative path suffixes, adjacent text and longer root names retain their meaning.
The review follow-up preserves paths attached to short options such as
-I,-Cand-o, including quoted and combined-letter options. A filesystem-independent regression explicitly uses/workspace/ci/runand covers host-path priority, virtual-path translation and escape rejection.Current head:
00f4ebe53930b4b739fda336fd65f1062827a6e5, including maind218ef806ab505e1a4754499af6a56e732812627. Both CHANGELOG entries are retained.Size
Relative to current main: src +37 net lines; tests +75 net lines, three new test functions and no new module. Size guard G1–G5 passed.
Verification on this head
32 focused tests passed. The attached-short-option cases produced 24 failures / 8 passes on the preceding implementation. Removing only the host-path-priority block makes the new literal
/workspaceregression fail.The two related modules initially recorded 379 passed / 7 failed / 3 skipped, with six default deselections. Five failures came from the environment's missing SOCKS dependency during LiteLLM catalog import; all five passed using LiteLLM's official bundled-catalog setting. The remaining two absolute-outside-source cases reproduce on unchanged
78f224dunder this host's/workspaceprefix.A full
make testattempt with fail-fast recorded 464 passed / 1 failed / 4 skipped / 20 deselected. The failure is an existing GitLab-script test that assumes/tmpexists; the same case fails on unchanged78f224d. This is not a full-suite pass.make lint, wheel/sdist build, changed-file formatting, whitespace checks and the size guard passed.Upstream CI on this revision and its six companion workflows await maintainer approval.
I am familiar with the Contributing Guidelines
Added focused tests and updated CHANGELOG.md
Ran make lint and make build
Completed a passing full make test
Did not add credentials, private datasets, or proprietary benchmark content
Earlier validation and reproducible artifacts at preceding revisions
Verification after upstream refresh
Merged upstream main
4b1143d4704bcb7983207c32c3ebfa667d0b3d96into this branch, preserving the original contribution as the first parent. Current source:78f224de85ff0ea9d503f860e3e3c5d2460e7440. The only conflict was inCHANGELOG.md; both entries are retained. Every contribution production and test blob is unchanged from the original source.make lint,make build(wheel and sdist),git diff --check, and the report-only size guard G1–G5 passed against the refreshed upstream.Exact refreshed tree, raw logs, commands, commit/parent metadata, and limitations.
Original-source verification (before refresh)
The following results were recorded before this upstream refresh and are retained as historical evidence for the original contribution.
tar, include/exclude filters, exact output contents, retained source files, and rejection of linked destinations. They cover quoted paths, overlapping/reordered mappings, host working directories, and literal URLs/adjacent text./workspaceprefix; both fail identically on unchanged main before destination or staging mutation./workspaceboth reproduce on unchanged main; the 396 provenance cases were not all rerun on the baseline.make lint,make build, changed-file formatting,git diff --check, and the size guard passed. A passing full-repository suite is not claimed.The 35-test selection is:
python -m pytest -q tests/test_harbor_local_environment.py tests/test_harbor_local_mode.py \ -k 'shell_path or collects_local_convention or artifact_parent_paths or logical_artifact_paths or contained_exclusion_download or contained_filtered_download or transfer_source or traversal or symlink or link_or_reparse or local_stream_redacts'make lintmake testmake buildRelease Impact
CHANGELOG.mdReproducible evidence
Independent verification scripts, retained results, and explicit test-environment limitations. Generated logs are isolated from this source branch.