Skip to content

fix: create user-data dir if missing - #473

Merged
Nikhil (shadowfax92) merged 1 commit into
mainfrom
feat/march17-test
Mar 17, 2026
Merged

fix: create user-data dir if missing#473
Nikhil (shadowfax92) merged 1 commit into
mainfrom
feat/march17-test

Conversation

@shadowfax92

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions Bot added the fix label Mar 17, 2026
@greptile-apps

greptile-apps Bot commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR ensures the default dev-profile directory (/tmp/browseros-dev) is created automatically when it does not exist, preventing failures on fresh environments or after a system reboot.

  • Adds os.MkdirAll(userDataDir, 0o755) in the else branch (non---new mode) before port-killing and process startup, mirroring the --new path that already uses os.MkdirTemp.
  • The call is idempotent — if the directory already exists, os.MkdirAll returns nil, so there is no regression for existing users.
  • Error is wrapped with fmt.Errorf("creating user-data dir: %w", err), consistent with Go idioms used elsewhere in the file.
  • No logic issues, dead code, or excessive logging introduced.

Confidence Score: 5/5

  • This PR is safe to merge — it is a minimal, idempotent fix with no behavioral regressions.
  • os.MkdirAll is a no-op when the directory already exists, so existing users are unaffected. The error path is properly handled and wrapped. The change is three lines in a dev-tooling file only, with no impact on production code.
  • No files require special attention.

Important Files Changed

Filename Overview
packages/browseros-agent/tools/dev/cmd/watch.go Adds os.MkdirAll in the default (non---new) branch to ensure /tmp/browseros-dev is created on first run or after a reboot. The fix is minimal, idempotent, and correctly wrapped with error handling.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[runWatch called] --> B{watchNew flag set?}
    B -- Yes --> C[os.MkdirTemp → fresh profile]
    B -- No --> D["os.MkdirAll(/tmp/browseros-dev, 0755) ← NEW"]
    D --> E{Error?}
    E -- Yes --> F[return error]
    E -- No --> G[KillPorts on default ports]
    G --> H[ResolveWatchPorts false]
    C --> I[ResolveWatchPorts true]
    H --> J[Start browser / agent + server procs]
    I --> J
    J --> K[Wait for Ctrl+C → graceful shutdown]
Loading

Last reviewed commit: 395b4ea

@shadowfax92
Nikhil (shadowfax92) merged commit 1779e1e into main Mar 17, 2026
5 of 7 checks passed
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.

1 participant