Repository navigation
fix(octop): guard Path.iterdir() with OSError in teams router and browser setup - #2659
Closed
TrueFurina wants to merge 1 commit into
Closed
TrueFurina wants to merge 1 commit into
TrueFurina wants to merge 1 commit into
Conversation
…wser setup Final two bare iterdir() calls on user-facing paths in Octop production code. Both are gated by is_dir() which only verifies the directory entry exists, not that the process has read permission. On Windows, ACL restrictions or antivirus file locks can still raise PermissionError when iterdir() runs. 1. api/routers/teams.py: team_template_files() serves default workspace templates from a package-level TEMPLATE_DIR. Wrap sorted(TEMPLATE_DIR.iterdir()) in try/except OSError and fall back to returning no templates (empty list). 2. infra/control/browser/setup.py: browser removal flow iterates profiles_root to stop Chrome processes. Wrap sorted(profiles_root.iterdir()) in try/except OSError so the cleanup degrades gracefully to skipping that step instead of aborting the whole uninstall/reset SSE stream.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wrap the final two bare Path.iterdir() calls in Octop production code with ry/except OSError. Two files, one commit.
Files changed
�pi/routers/teams.py — eam_template_files()`n
Serves default team workspace markdown templates from TEMPLATE_DIR. Gated by is_dir() which is insufficient on Windows — the directory can exist but be ACL-restricted or locked by antivirus. On OSError fall back to an empty file list.
infra/control/browser/setup.py — browser cleanup flow
Iterates the Playwright Chrome profiles root to stop Octop-managed processes before deleting Playwright binaries. An unhandled PermissionError here would abort the entire uninstall/reset SSE stream mid-way. On OSError skip the per-profile step and continue with Chromium dir removal.
Pattern
This closes out the Path.iterdir() defensive-itdir sweep across both repos: server.py (#2657), skill_packages.py + init.py (#2658), harness workspace/loader/skill/slash_router (#191-#193), skill_package_store.py, workspace_catalog.py, and browser_media.py. Future sweeps can focus on Path.glob/
glob onerror and os.scandir paths.