fix: stop Jarvis reply failures on /proc map_files EPERM - #16
fix: stop Jarvis reply failures on /proc map_files EPERM#16warheart1984-ctrl wants to merge 1 commit into
Conversation
Workspace tools defaulted to Path(__file__).parents[2], which is / in the Docker /app layout. Chat then walked /proc/1/map_files and died with EPERM. Pin the root to the repo, skip proc/sys/dev, and fail-open on blocked introspection. Co-authored-by: Cursor <cursoragent@cursor.com>
| if _is_filesystem_root(candidate) or not candidate.is_dir(): | ||
| return fallback |
There was a problem hiding this comment.
Invalid Roots Retarget Patches
If AAIS_WORKSPACE_ROOT or an explicit workspace path names a deleted, renamed, or nonexistent project, resolve_workspace_root silently substitutes the source repository; patch preview then validates that unintended root and patch application can write matching relative targets into the wrong project instead of failing.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workspace_root.py
Line: 82-83
Comment:
**Invalid Roots Retarget Patches**
If `AAIS_WORKSPACE_ROOT` or an explicit workspace path names a deleted, renamed, or nonexistent project, `resolve_workspace_root` silently substitutes the source repository; patch preview then validates that unintended root and patch application can write matching relative targets into the wrong project instead of failing.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| """Safe workspace-root resolution for Jarvis local file tools. | ||
|
|
||
| Mythic: Operator Workshop Boundary | ||
| Engineering: WorkspaceRootResolver | ||
|
|
||
| Inputs: optional env override, optional explicit root, calling module path | ||
| Outputs: absolute Path confined to the repo (never filesystem root) | ||
| Constraints: read-only resolution; never walk `/`, `/proc`, `/sys`, `/dev` | ||
| Failure modes: missing/invalid override → fall back to repo root; EPERM on | ||
| proc map introspection must not reach chat (walkers skip unsafe dirs) |
There was a problem hiding this comment.
Subsystem Header Fields Missing
The new subsystem uses a prose docstring instead of the required five-field Mythic, Engineering, Responsibilities, Non-responsibilities, and Invariants comment header, leaving its repository-mandated ownership and boundary information incomplete.
Context Used: One subsystem per file; mandatory file header bloc... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workspace_root.py
Line: 1-10
Comment:
**Subsystem Header Fields Missing**
The new subsystem uses a prose docstring instead of the required five-field Mythic, Engineering, Responsibilities, Non-responsibilities, and Invariants comment header, leaving its repository-mandated ownership and boundary information incomplete.
**Context Used:** One subsystem per file; mandatory file header bloc... ([source](https://github.com/warheart1984-ctrl/project-infinity/blob/main/.cursor/rules/jon-file-structure.mdc))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
|
|
||
| def _looks_like_repo_root(candidate: Path) -> bool: | ||
| return (candidate / "pyproject.toml").is_file() or ( |
There was a problem hiding this comment.
Public Function Comments Missing
The newly added default_repo_root and resolve_workspace_root public functions lack the required Mythic and Engineering comment pairs, so their operator intent and deterministic behavior are not documented according to the repository convention.
Context Used: Dual-layer Mythic + Engineering comments with inva... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workspace_root.py
Line: 36
Comment:
**Public Function Comments Missing**
The newly added `default_repo_root` and `resolve_workspace_root` public functions lack the required Mythic and Engineering comment pairs, so their operator intent and deterministic behavior are not documented according to the repository convention.
**Context Used:** Dual-layer Mythic + Engineering comments with inva... ([source](https://github.com/warheart1984-ctrl/project-infinity/blob/main/.cursor/rules/jon-dual-comments.mdc))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
Path(__file__).parents[2], which is/in the Docker/applayout. Chat then walked/proc/1/map_files/...and died with[Errno 1] Operation not permitted.proc/sys/dev/map_filesduring walks, and fail-open on EPERM so telemetry/introspection cannot abort a reply.AAIS_WORKSPACE_ROOT=/appin Docker/Render.Test plan
python3 -m pytest tests/test_workspace_root.py tests/test_jarvis_operator.py::TestWorkspaceTools tests/test_patch_execution_preview_organ.py tests/test_patch_apply_organ.py -qJarvis could not reply: [Errno 1] ... /proc/1/map_files/...toastMade with Cursor
Greptile Summary
The PR centralizes workspace-root resolution, prevents default traversal of the filesystem root and pseudo-filesystems, and makes Jarvis workspace searches tolerate filesystem permission failures. It also configures the container deployments to use
/app.AAIS_WORKSPACE_ROOTin Docker and Render deployment configuration.Confidence Score: 4/5
The invalid-workspace fallback should be fixed before merging because it can redirect an approved patch into the application repository rather than failing on an unavailable intended project.
Patch preview and application now replace a nonexistent configured workspace with the inferred source repository, allowing matching relative patch targets to be validated and written in the wrong project; the remaining findings concern required repository documentation.
Files Needing Attention: src/workspace_root.py, src/patch_apply_engine.py, src/patch_execution_preview.py
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Resolve workspace root] --> B{Environment override set?} B -->|Yes| C[Resolve environment path] B -->|No| D{Explicit root supplied?} D -->|Yes| E[Resolve explicit path] D -->|No| F[Infer repository root] C --> G{Filesystem root or invalid directory?} E --> G G -->|Yes| F G -->|No| H[Use selected workspace] F --> H H --> I[Workspace search and indexing] H --> J[Patch preview] J --> K[Patch application]Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix: keep Jarvis replies off /proc map_f..." | Re-trigger Greptile
Context used: