Skip to content

fix(security): run controller as non-root 'taos' user (#639) - #677

Merged
jaylfc merged 5 commits into
devfrom
fix/drop-root-639
Jun 8, 2026
Merged

fix(security): run controller as non-root 'taos' user (#639)#677
jaylfc merged 5 commits into
devfrom
fix/drop-root-639

Conversation

@jaylfc

@jaylfc jaylfc commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Installer (scripts/install-server.sh): creates a dedicated taos system user (idempotent), adds it to the incus and docker groups (warns instead of failing if either group is absent), substitutes User=taos/Group=taos into the rendered system unit (was $USER), then chown -R taos:taos data/ (mode 0700) and chmod 0600 the sensitive credential files after the venv/data setup.
  • Installer service template (scripts/systemd/tinyagentos.service): no change needed — TAOS_USER/TAOS_GROUP placeholders were already there; the ExecStartPre=+chmod debugfs lines already carry the + root-override prefix and continue to work as-is.
  • Armbian image overlay (os-build/userpatches/overlay/etc/systemd/system/tinyagentos.service): User=rootUser=taos, Group=taos added.
  • Armbian build extension (os-build/userpatches/extensions/tinyagentos.sh): creates taos user in the image chroot, adds to incus/docker groups (creates them if absent so the user record is correct even before packages land at first-boot), chown -R taos:taos /opt/tinyagentos/data (0700).
  • tinyagentos/deployer.py: one-line comment only — os.getuid() returning the taos UID is correct for raw.idmap both {uid} 0 (maps container-root to the host taos UID for the trace bind-mount). No behaviour change.
  • systemd/tinyagentos-host-firewall.service: left as-is — it is a separate root oneshot for iptables rules and does not need to change.
  • Migration script (scripts/pre-beta-to-beta.sh): run-once helper for existing users upgrading from a root-based pre-beta install to this non-root beta layout (see below).

What was not changed

  • The installer itself still runs as root (via sudo bash) — the drop to taos is in the systemd unit only.
  • The install_linux_systemd_user path (no-sudo fallback) still uses $USER as before — it runs as the calling user by design.
  • No auth bypass; no weakening of any security boundary.

Root-only assumptions checked

The only genuine concern was os.getuid() in deployer.py being passed as host_uid to incus raw.idmap. Verified: raw.idmap both {uid} 0 maps container-root to whatever UID the controller runs as. When running as taos (a non-zero UID) this is correct and required — it ensures the trace bind-mount directory owned by taos is writable by the container. No code change needed.

Migration script — pre-beta → beta (scripts/pre-beta-to-beta.sh)

Existing users who ran a root-based pre-beta install (typically at /root/tinyagentos on the Pi) need to copy their data to the new non-root layout. Run this after the beta installer has been applied:

sudo bash scripts/pre-beta-to-beta.sh

Or with explicit paths if auto-detection is ambiguous:

sudo bash scripts/pre-beta-to-beta.sh \
  OLD_TAOS_DIR=/root/tinyagentos \
  NEW_TAOS_DIR=/opt/tinyagentos

Pass --yes to skip the interactive confirmation prompt.

What it does (in order):

  1. Stops tinyagentos.service
  2. Backs up NEW/data/ to a timestamped .tgz if it already has content (never overwrites without a backup)
  3. Copies OLD/data/NEW/data/ (cp -a, preserving timestamps/perms)
  4. Ensures the taos system user exists and has incus/docker group membership (same logic as the installer)
  5. chown -R taos:taos NEW/ (whole install dir) + chmod 0700 data/ + chmod 0600 credential files
  6. Patches the systemd unit from User=rootUser=taos if the old unit is still in place
  7. systemctl daemon-reload && systemctl start tinyagentos
  8. Verifies the service is active and running as taos; prints PASS/FAIL with next steps

The OLD install is never modified or deleted — it is left intact for rollback.

Updater compatibility

Two additional fixes so the in-app updater (Settings → Updates) works correctly when running as non-root taos:

Fix 1 — taos owns the whole install dir, not just data/

The updater needs to write to .git/ (git pull), .venv/ (pip install -e .), and static/desktop/ (npm run build). set_data_dir_ownership() in install-server.sh previously only chowned data/; it now chowns the entire INSTALL_DIR first, then tightens data/ to 0700 and secret files to 0600 on top (order matters — restrictive perms win). The same change is mirrored in pre-beta-to-beta.sh and the Armbian build extension.

Security trade-off: taos owning its own code directory is the minimum required for non-root in-app self-update without a privileged helper. Full update-privilege-separation (a signed updater suid binary that verifies integrity before writing) is a post-beta hardening task.

Fix 2 — pending-restart flag moved out of ~/.config

restart_orchestrator.py previously hardcoded ~/.config/taos/pending-restart.json. The taos service user is created with -M (no home directory), so ~ does not resolve to a writable path under systemd.

Replaced the module-level constant with a _pending_restart_path() helper. Resolution order:

  1. $TAOS_DATA_DIR/pending-restart.json — when the env var is set (already used by __main__.py for the Mac app).
  2. <install_dir>/data/pending-restart.json — derived from Path(__file__).parent.parent / "data", which is the same PROJECT_DIR / "data" convention used throughout app.py. This is the path used on every standard Linux install.
  3. ~/.config/taos/pending-restart.json — backward-compatible fallback for root-based or developer installs where ~ resolves correctly.

The systemd unit template does not need a new Environment=TAOS_DATA_DIR=… line: the module-location fallback (__file__../../data) resolves to the correct <install_dir>/data directory automatically, because the process is always launched with WorkingDirectory=<install_dir> and the module lives inside that tree.

All three functions (write_pending_restart, read_pending_restart, clear_pending_restart) now call _pending_restart_path() so the path is consistent across write/read/clear.

Pi test plan (deploy-time — validate on Pi before relying on it)

This is a deploy-time change with no automated CI coverage. Validate on the Orange Pi 5 Plus:

  • Re-run the installer (or sudo bash scripts/install-server.sh) on the Pi to create the taos user and update the unit.
  • Verify user and groups: id taos — expect uid=<N>(taos) gid=<N>(taos) groups=...,incus,docker.
  • Verify unit user: systemctl show -p User tinyagentos — expect User=taos.
  • Verify service starts: systemctl status tinyagentos — Active: active (running).
  • Verify process UID: ps -o user= -p $(systemctl show -p MainPID tinyagentos | cut -d= -f2) — expect taos.
  • Install dir ownership: ls -la /opt/tinyagentos/ — expect taos:taos owner throughout; data/ should be drwx------.
  • Auth/login works: open http://taos.local:6969, log in.
  • Agent deploy works: deploy a test agent — verifies incus socket access via incus group.
  • Traces write: check data/trace/<slug>/ is created and populated by the container.
  • Host-firewall unit: systemctl status tinyagentos-host-firewall — still applies iptables rules (runs as root, unaffected by this change).
  • RKNPU stats: check the taOS hardware panel shows NPU load (the ExecStartPre=+chmod debugfs lines run as root regardless of User=taos).
  • In-app updater: trigger an update from Settings → Updates and confirm it completes without permission errors.
  • Pending-restart flag: after an update, confirm data/pending-restart.json is created (not ~/.config/taos/).
  • Migration script (Pi): on the Pi with an existing /root/tinyagentos install, run sudo bash scripts/pre-beta-to-beta.sh --yes and verify the 8-step output ends with Migration PASSED, the service is active as taos, and data is intact.

Note: deploy-time change only. Validate on Pi before merging to dev.

Summary by CodeRabbit

  • New Features

    • Service now runs under a dedicated unprivileged system user for improved safety.
    • Added a migration tool to move pre-beta installs into the new layout while preserving data.
  • Security Improvements

    • Data and credential files now receive stricter ownership and permissions to limit access.
  • Install/Upgrade

    • Installer and upgrade workflow log and enforce the new service user and data ownership.

The tinyagentos.service unit now runs as a dedicated system user 'taos'
instead of root. The installer still runs as root (via sudo bash); only
the resulting systemd runtime drops to the unprivileged user.

Changes:
- scripts/install-server.sh: create system user 'taos' (idempotent),
  add to incus + docker groups (warn if absent, don't fail), substitute
  User=taos/Group=taos into the system unit template, chown data/ to
  taos:taos (0700) and chmod 0600 sensitive credential files after setup
- scripts/systemd/tinyagentos.service: unchanged — TAOS_USER/TAOS_GROUP
  placeholders already present, ExecStartPre=+ debugfs lines already
  have the root-override prefix and remain correct
- os-build/userpatches/overlay/etc/systemd/system/tinyagentos.service:
  User=root → User=taos, Group=taos added
- os-build/userpatches/extensions/tinyagentos.sh: create taos user in
  the Armbian image chroot, add to incus/docker groups, chown data dir
- tinyagentos/deployer.py: one-line comment clarifying os.getuid()
  returns the taos UID when running under systemd (no behaviour change)
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jaylfc, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 14 minutes and 40 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a4390eab-a239-408f-9e3a-657c9d66c78a

📥 Commits

Reviewing files that changed from the base of the PR and between 4eba780 and e4704c0.

📒 Files selected for processing (6)
  • os-build/userpatches/extensions/tinyagentos.sh
  • os-build/userpatches/overlay/etc/systemd/system/tinyagentos.service
  • scripts/install-server.sh
  • scripts/pre-beta-to-beta.sh
  • tinyagentos/deployer.py
  • tinyagentos/restart_orchestrator.py
📝 Walkthrough

Walkthrough

Migrates TinyAgentOS to run as a non-root system user (taos): image and service updates, installer functions and integration, a pre-beta→beta migration script, container runtime comment, and dynamic pending-restart path resolution.

Changes

Non-Root Service Migration (root → taos)

Layer / File(s) Summary
Image Build and Service Configuration
os-build/userpatches/extensions/tinyagentos.sh, os-build/userpatches/overlay/etc/systemd/system/tinyagentos.service
Image customization creates the taos system user, idempotently wires incus/docker groups, tightens /opt/tinyagentos ownership/permissions, and the systemd unit now runs as User=taos Group=taos.
Installer User Provisioning and Ownership Functions
scripts/install-server.sh (lines 1233–1310, 1324–1364, 1668–1689)
Adds ensure_taos_user() and set_data_dir_ownership(); installer invokes provisioning before templating the systemd unit, hardcodes TAOS_USER=taos/TAOS_GROUP=taos, updates logs, and detects pre-beta installs with a migration hint.
Pre-Beta to Beta Migration Tool
scripts/pre-beta-to-beta.sh
New root-only migration script: detects old/new installs, backs up existing data, copies legacy data/ (and optional trace/), provisions taos, applies ownership/permissions, patches systemd unit to taos, restarts and verifies the service, and emits PASS/WARN guidance.
Container Runtime Documentation
tinyagentos/deployer.py (lines 284–286)
Adds comment explaining how host_uid=os.getuid() and raw.idmap keep the trace bind-mount writable in idmapped/unprivileged container setups.
Pending-restart path resolution
tinyagentos/restart_orchestrator.py
Replaces fixed PENDING_RESTART_PATH with _pending_restart_path() that prefers $TAOS_DATA_DIR, then derived install data/, then ~/.config/taos/...; updates read/write/clear functions to use the computed path.

Sequence Diagram

sequenceDiagram
  participant Installer as install-server.sh
  participant TaosSetup as TaosProvisioning
  participant SystemdConfig as SystemdUnitConfig
  participant DataOwnership as DataDirSetup
  Installer->>TaosSetup: ensure_taos_user()
  TaosSetup->>TaosSetup: create taos user, add to groups
  Installer->>SystemdConfig: substitute User=taos Group=taos
  Installer->>DataOwnership: set_data_dir_ownership()
  DataOwnership->>DataOwnership: chown/chmod to taos:taos, tighten secrets
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Poem

🐰 I nibble at scripts both old and new,
I craft a user named taos for you—
From root we step aside with careful art,
Data locked and owned, each secret played its part.
Hop on; the service runs with gentler heart.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: migrating the controller from root to a dedicated 'taos' user for improved security, which is the core objective throughout all modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/drop-root-639

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
scripts/install-server.sh (1)

1292-1293: ⚡ Quick win

Silent chown failure masks issues that would cause service startup failure.

If chown fails (e.g., taos user doesn't exist due to an earlier failure), the service won't be able to write to data/ and will fail at runtime with a confusing error. The migration script (pre-beta-to-beta.sh) warns on this same failure:

chown -R taos:taos "$NEW_TAOS_DIR/data" 2>/dev/null \
    || warn "  chown failed (taos user may not exist) — service will fail to start"

Consider matching that pattern here for consistency and better diagnostics.

♻️ Proposed fix
-    chown -R taos:taos "$INSTALL_DIR/data" 2>/dev/null || true
+    chown -R taos:taos "$INSTALL_DIR/data" 2>/dev/null \
+        || warn "chown failed (taos user may not exist) — service will fail to start"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/install-server.sh` around lines 1292 - 1293, The silent chown in
install-server.sh masks failures; replace the suppressed fallback on the chown
-R taos:taos "$INSTALL_DIR/data" 2>/dev/null || true with the same diagnostic
behavior used in pre-beta-to-beta.sh—i.e., if chown fails, call the existing
warn function (or print a stderr warning if warn is not available) with a clear
message like "chown failed (taos user may not exist) — service will fail to
start" so operators see the cause instead of silently continuing.
scripts/pre-beta-to-beta.sh (1)

300-303: 💤 Low value

Minor: Comment mentions "group" but code applies to "others".

The comment says "group execute+read" but o+rX modifies permissions for "others", not "group". The code is correct (taos isn't in root's group, so others-read is needed), but the comment is misleading.

📝 Suggested comment fix
-# The venv and source tree must be readable by the taos user (group
-# execute+read) but owned by root is fine — taos does not need write access.
+# The venv and source tree must be readable by the taos user (world
+# read+execute) but owned by root is fine — taos does not need write access.
 if [[ -d "$NEW_TAOS_DIR/.venv" ]]; then
     chmod -R o+rX "$NEW_TAOS_DIR/.venv" 2>/dev/null || true
 fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/pre-beta-to-beta.sh` around lines 300 - 303, Update the misleading
comment above the chmod line that currently states "group execute+read" to
accurately describe the permission change being applied to others; reference the
chmod invocation that uses chmod -R o+rX on "$NEW_TAOS_DIR/.venv" and change the
comment to state that the venv and source tree must be readable/executable by
others (o+rX) because the taos user is not in the owning group, or alternatively
clarify both cases if group membership is possible.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@os-build/userpatches/extensions/tinyagentos.sh`:
- Around line 37-40: The usermod call currently swallows failures with "||
true", preventing the outer display_alert from running; remove the "|| true" so
that a failing usermod inside the chroot (the block that uses
getent/groupadd/usermod with variables ${SDCARD}, ${grp}, taos) returns non-zero
and triggers the outer display_alert "TinyAgentOS" path; ensure you still
suppress expected stderr if desired (e.g., keep "2>/dev/null" only if you intend
to ignore noisy output) but do not mask the exit status of usermod so membership
update failures are detectable.
- Around line 47-51: The success alert is always shown even though the
chown/chmod are masked with "|| true"; change the block that runs chroot and the
chown/chmod so it captures their exit status and only calls display_alert
"TinyAgentOS" "Set /opt/tinyagentos/data ownership to taos:taos (0700)" "info"
when both commands succeed, otherwise call display_alert with an error/failure
message; specifically modify the chroot "... chown -R taos:taos
/opt/tinyagentos/data ... chmod 0700 ..." invocation to remove the unconditional
"|| true" masking and check the combined exit code (or inspect individual exits)
before invoking display_alert, referencing the chroot invocation and the
chown/chmod commands and the display_alert call to locate the change.

---

Nitpick comments:
In `@scripts/install-server.sh`:
- Around line 1292-1293: The silent chown in install-server.sh masks failures;
replace the suppressed fallback on the chown -R taos:taos "$INSTALL_DIR/data"
2>/dev/null || true with the same diagnostic behavior used in
pre-beta-to-beta.sh—i.e., if chown fails, call the existing warn function (or
print a stderr warning if warn is not available) with a clear message like
"chown failed (taos user may not exist) — service will fail to start" so
operators see the cause instead of silently continuing.

In `@scripts/pre-beta-to-beta.sh`:
- Around line 300-303: Update the misleading comment above the chmod line that
currently states "group execute+read" to accurately describe the permission
change being applied to others; reference the chmod invocation that uses chmod
-R o+rX on "$NEW_TAOS_DIR/.venv" and change the comment to state that the venv
and source tree must be readable/executable by others (o+rX) because the taos
user is not in the owning group, or alternatively clarify both cases if group
membership is possible.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1299927e-1b18-46ec-b59f-257454b34455

📥 Commits

Reviewing files that changed from the base of the PR and between 4eba780 and 5648424.

📒 Files selected for processing (5)
  • os-build/userpatches/extensions/tinyagentos.sh
  • os-build/userpatches/overlay/etc/systemd/system/tinyagentos.service
  • scripts/install-server.sh
  • scripts/pre-beta-to-beta.sh
  • tinyagentos/deployer.py

Comment thread os-build/userpatches/extensions/tinyagentos.sh
Comment thread os-build/userpatches/extensions/tinyagentos.sh Outdated
jaylfc added 2 commits June 7, 2026 20:38
…+ move pending-restart flag to data dir (#639)

Two updater-compatibility fixes for the non-root taos service user introduced in #677:

1. chown the whole INSTALL_DIR to taos (not just data/) so the in-app updater
   can write to .git/, .venv/, and static/desktop/ during git pull,
   pip install -e ., and npm run build.  Mirrored in install-server.sh,
   pre-beta-to-beta.sh, and the Armbian image extension.  Data dir and
   secret files are tightened AFTER the broad chown so restrictive perms win.
   Security trade-off noted in comments: full update-privilege-separation is
   post-beta hardening.

2. Replace the hardcoded ~/.config/taos/pending-restart.json path with a
   _pending_restart_path() helper in restart_orchestrator.py.  Resolution
   order: TAOS_DATA_DIR env (already used by __main__.py for Mac) →
   <install_dir>/data (derived from __file__, matches PROJECT_DIR/"data" in
   app.py) → ~/.config/taos fallback for root/dev installs.  All
   write/read/clear calls updated to use the helper.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tinyagentos/restart_orchestrator.py`:
- Around line 56-59: The current broad except blocks around path.read_text() and
json.loads (and the similar block around path.unlink()) swallow all errors;
change them to handle only FileNotFoundError (return None for read, ignore for
unlink) and let other errors surface: replace "except Exception:" with "except
FileNotFoundError: return None" for the read path (keeping json.JSONDecodeError
handled explicitly if desired) and for the clear/unlink path catch
FileNotFoundError and re-raise or log and re-raise any other exceptions so
ownership/permission/filesystem errors are not hidden; refer to the occurrences
using path.read_text(), json.loads(...) and path.unlink() to locate the two
fixes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9b080440-d327-4b0e-a8c7-1883a1855f3a

📥 Commits

Reviewing files that changed from the base of the PR and between 5648424 and 8aa6e3e.

📒 Files selected for processing (4)
  • os-build/userpatches/extensions/tinyagentos.sh
  • scripts/install-server.sh
  • scripts/pre-beta-to-beta.sh
  • tinyagentos/restart_orchestrator.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • os-build/userpatches/extensions/tinyagentos.sh
  • scripts/pre-beta-to-beta.sh
  • scripts/install-server.sh

Comment on lines 56 to 59
try:
return json.loads(PENDING_RESTART_PATH.read_text())
return json.loads(path.read_text())
except Exception:
return None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid swallowing filesystem failures in pending-restart read/clear paths.

Line 58 and Line 65 currently hide all errors, which can mask ownership/permission regressions after the root→taos migration and produce false “no pending restart” states in update-status/boot-time checks.

Suggested fix
 def read_pending_restart() -> dict | None:
     path = _pending_restart_path()
     if not path.exists():
         return None
     try:
         return json.loads(path.read_text())
-    except Exception:
+    except json.JSONDecodeError:
+        logger.warning("Invalid pending restart JSON at %s", path)
+        return None
+    except OSError:
+        logger.exception("Failed reading pending restart file at %s", path)
         return None


 def clear_pending_restart() -> None:
     try:
         _pending_restart_path().unlink(missing_ok=True)
-    except Exception:
-        pass
+    except OSError:
+        logger.exception("Failed clearing pending restart file")

Also applies to: 63-66

🧰 Tools
🪛 Ruff (0.15.15)

[warning] 58-58: Do not catch blind exception: Exception

(BLE001)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tinyagentos/restart_orchestrator.py` around lines 56 - 59, The current broad
except blocks around path.read_text() and json.loads (and the similar block
around path.unlink()) swallow all errors; change them to handle only
FileNotFoundError (return None for read, ignore for unlink) and let other errors
surface: replace "except Exception:" with "except FileNotFoundError: return
None" for the read path (keeping json.JSONDecodeError handled explicitly if
desired) and for the clear/unlink path catch FileNotFoundError and re-raise or
log and re-raise any other exceptions so ownership/permission/filesystem errors
are not hidden; refer to the occurrences using path.read_text(), json.loads(...)
and path.unlink() to locate the two fixes.

Source: Linters/SAST tools

@jaylfc

jaylfc commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant