fix(runagent): forward runtime agent vars into rootless exec - #1253
fix(runagent): forward runtime agent vars into rootless exec#1253DavidePrincipi wants to merge 1 commit into
Conversation
"runuser -l" resets the environment before handing off to a rootless module's user, so AGENT_TASK_ID and the other runtime agent vars documented in core/agent/README.md (AGENT_COMFD, AGENT_TASK_ACTION, AGENT_TASK_USER) were silently dropped. This broke task-context features such as progress reporting for any action run against a rootless module. Forward them explicitly alongside XDG_RUNTIME_DIR. Assisted-by: Claude Code:claude-sonnet-5
Security review: does forwarding
|
Summary
runuser -lresets the environment before handing off to a rootlessmodule's own user, so
AGENT_TASK_IDand the other runtime agent varsdocumented in
core/agent/README.md(AGENT_COMFD,AGENT_TASK_ACTION,AGENT_TASK_USER) were silently dropped wheneverrunagentswitchedinto a rootless module's context (e.g.
run-backup→runagent -m <module_id> module-backup).runagentnow forwards them explicitly,alongside
XDG_RUNTIME_DIR.This is the rootless counterpart of #1252. For rootful modules, no
user switch is needed, so
AGENT_TASK_IDwas always inherited andmodule-backupcorrectly took itsprogress_callbackbranch — whichis exactly the code path that crashed with
Popen.__init__() got an unexpected keyword argument 'check'before #1252. Rootless modulesnever hit that crash only because they never reached the
progress_callbackbranch in the first place: withAGENT_TASK_IDmissing,
module-backupsilently fell back to the plainrun_restic(...).check_returncode()path, so manual "Run backup now"backups for rootless apps completed but never reported progress.
With this fix, rootless modules now also take the
progress_callbackbranch during task-driven backups, exercising the same
run_resticcode path that #1252 fixed. Since #1252 is alreadymerged, that path should be safe, but this PR is the change that
newly exposes it to rootless modules and restores progress reporting
there.
Related issue
NethServer/dev#8076
How to test
completed silently with no progress updates for rootless apps).
Dependencies
Builds on #1252 (already merged) — that PR fixed the
checkkwargcrash in
run_restic'sPopenpath; this PR is what makes rootlessmodules actually reach that code path.