Skip to content

session-lifecycle hook: node not found on PATH in scheduled-task bash sessions #811

Closed as not planned

Description

@kyle-sexton

Observed twice (2026-07-21) in autonomy drain runs under Desktop scheduled-task sessions on Windows:

SessionEnd hook [node "${CLAUDE_PLUGIN_ROOT}/scripts/session-lifecycle-hook.mjs" SessionEnd] failed: /usr/bin/bash: line 1: node: command not found

Non-fatal (drain PR + evidence unaffected) but the lifecycle hook silently no-ops in every scheduled session — whatever it records is missing for exactly the unattended runs the autonomy program most wants observed. Root cause to investigate: the scheduled-task session's bash environment does not inherit the PATH entries interactive shells get (nvm/volta/winget shims). Candidate fixes: hook resolves node via an absolute path or launcher fallback; or hook degrades loudly (one-line report) instead of failing.

Related

Activity

  1. kyle-sexton commented on Jul 21, 2026

    @kyle-sexton
    MemberAuthor

    Fresh repro from an unattended scheduled-task session (2026-07-21, Desktop task autonomy-demo-hourly-drain, session 304d5d85, 09:05Z fire):

    • SessionStart:startup hook: /usr/bin/bash: line 1: node: command not found (exit 127) — twice (caveman loader + plugin script).
    • Stop hook (stop-review-gate-hook.mjs): same node: command not found (exit 127).

    Both non-blocking, but every node-based hook silently no-ops in scheduled sessions — the run had zero hook coverage. Confirms the PATH gap is session-lifecycle-wide (start AND stop), not SessionEnd-specific.

  2. kyle-sexton commented on Jul 21, 2026

    @kyle-sexton
    MemberAuthor

    Root cause found (2026-07-21 session): fnm shell-init-only PATH.

    Node on this machine is managed by fnm 1.39.0 (winget). fnm injects node onto PATH per-shell via fnm env multishell dirs (%LOCALAPPDATA%\fnm_multishells\...) evaluated in shell init. GUI-launched processes — the Desktop app's scheduled-task sessions — never run shell init, so their bash has no node. Confirms the PATH-gap hypothesis; scope is every GUI-launched session, exactly matching the observed SessionStart/Stop/SessionEnd exit-127 trio.

    Verified stable target: %APPDATA%\fnm\aliases\default is a symlink fnm retargets on fnm default changes; it resolves to node-versions\<default>\installation containing node.exe (verified live: currently → v24.17.0). Putting it on the user Path gives GUI apps node while shell sessions keep multishell precedence (multishell prepends; no conflict).

    Fix (operator action — env-var mutation is classifier-gated for agents). Run once in PowerShell:

    $cur = [Environment]::GetEnvironmentVariable('Path','User')
    $add = "$env:APPDATA\fnm\aliases\default"
    if (-not (($cur -split ';') -contains $add)) { [Environment]::SetEnvironmentVariable('Path', ($cur.TrimEnd(';') + ';' + $add), 'User') }

    Then restart the Claude Desktop app (GUI processes read user Path at start). Verification: next scheduled fire's transcript should show zero node: command not found hook failures.

    Documented residuals:

    • The alias-dir layout is fnm-internal, not an upstream-documented contract (fnm README documents shell-init only). Drift on an fnm upgrade fails LOUD (hooks report exit 127 again) — detectable, reversible by removing the Path entry.
    • Alternatives weighed and rejected: system-wide second Node install (version drift vs fnm default); plugin-side absolute node path (couples plugin to one machine's layout — wrong layer). A separate plugin-side improvement stands on its own merits: node-based hooks should degrade LOUDLY (one-line stderr report) instead of silently no-opping — left to this issue's scope decision.
  3. kyle-sexton commented on Jul 22, 2026

    @kyle-sexton
    MemberAuthor

    Fix verified (2026-07-22). Operator ran the user-Path one-liner and restarted the Desktop app (~14:00Z). First scheduled fire after restart — run scheduled-20260722T140625Z, outer session transcript cec3c565-b4f9-449e-abc3-1784dd25d63d — contains ZERO node: command not found and zero exit-127 hook failures (prior fires had 4 per session). Scheduled-session hook coverage is restored.

    Durable capture: the Path entry is codified as a chezmoi run-script in melodic-software/dotfiles#291 (open), with the revert trigger + durable-fix research tracked in melodic-software/dotfiles#292. Remaining in-scope question from the root-cause comment — whether node-based hooks should degrade loudly instead of silently no-opping — stays with this issue.

  4. added
    needs-human
    on Jul 23, 2026
  5. kyle-sexton commented on Jul 27, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI (triage lane — gate-audit claim). Claiming this item for one gate-audit cycle: an independent panel re-classifies whether the needs-human / status: needs-decision gate is still warranted, or whether the item is C2/C3 and liftable to agent-ready. Outcome comment follows in this cycle.

  6. kyle-sexton commented on Jul 27, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI (triage lane — gate audit). Independent panel: two fresh-context agents (one fable, one opus), each given only the issue content and the repo's own plugins/autonomy/reference/guardrails/work-classes.md, plus the triage lane's own read. This lane never executes work items, authors fixes, or merges.

    Gate audit: GATE UPHELD — root cause fixed; only an undecided residual remains

    Panel: 2-of-2 STAYS-GATED. Lane read concurs.

    The reported bug is fixed and empirically verified. The root cause (fnm shell-init-only PATH) was resolved by an operator machine-level action, with zero exit-127 hook failures in run scheduled-20260722T140625Z, and the durable capture landed in melodic-software/dotfiles (#291/#292).

    What holds the gate is a single undecided residual the issue explicitly kept: whether node-based hooks should degrade loudly instead of silently no-opping. A cold agent cannot know whether to close this as fixed or implement that change under it.

    Material finding — this changes the shape of the decision: one leg searched the tree and found the residual has essentially no in-repo surface. Neither session-lifecycle-hook.mjs nor stop-review-gate-hook.mjs exists in this repo, no hooks.json across the 16 hook-carrying plugins invokes node, and the only hook-named .mjs files (plugins/knowledge/skills/*/extraction/register-hook.mjs) are Node module-resolution hooks, not Claude Code lifecycle hooks. The loud-degradation change largely cannot be implemented here.

    Decision required

    Does this close as delivered, or get re-scoped to a loud-degradation contract?

    RECOMMENDED — close it as fixed-and-verified, and re-file the loud-degradation concern against the repo that actually owns node-based hooks. The fix is done and proven; the residual belongs where the surface lives (dotfiles / whichever repo carries the node hooks), not on a closed defect in a repo with no node lifecycle hooks to harden. Keeping it open conflates a solved incident with an unfiled design preference.

    Alternative — re-scope this issue to a repo-wide "no silent hook no-op" convention. That is a C4 contract change binding every future node-based hook, and should be filed as such rather than inherited from a PATH incident.

  7. kyle-sexton commented on Jul 27, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI (triage lane — claim release). Gate-audit cycle complete for this item; the triage claim posted earlier this cycle is released. No lease is held — another instance or lane may pick this up immediately. The outcome comment above this one carries the classification and either the lift rationale or the decision summary.

  8. added
    agent-ready
    and removed
    needs-human
    on Aug 13, 2026
  9. kyle-sexton commented on Aug 13, 2026

    @kyle-sexton
    MemberAuthor

    Frontier disposition (drain session)

    Ruling: Promote to agent-ready.

    Small scoped bug with a bounded blast radius and enough specification for autonomous pickup. Removed needs-human, added agent-ready.

    Re-open trigger: If implementation reveals an unresolved design fork or security policy decision.

  10. kyle-sexton commented on Aug 13, 2026

    @kyle-sexton
    MemberAuthor

    Frontier disposition (drain session)

    Ruling: Close as not planned for this drain wave (frontier consensus).

    Dual-panel drain ruling: advisory, superseded, folded into a program umbrella, or blocked on a host/design carrier without an actionable in-repo slice this session. Re-open with a concrete acceptance brief if a consumer needs the work.

    KEEP set for this wave: standing telemetry; host-physical Class C (#631 family); program umbrellas #530/#531/#532/#535; live design carriers #1500/#1553/#1668/#1695/#1716/#1681/#1718; #1360.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-ready

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions