Skip to content

fix: wire onSpawn in runChildProcess call#99

Open
faizer1989 wants to merge 1 commit into
NousResearch:mainfrom
faizer1989:aiw-185-wire-on-spawn
Open

fix: wire onSpawn in runChildProcess call#99
faizer1989 wants to merge 1 commit into
NousResearch:mainfrom
faizer1989:aiw-185-wire-on-spawn

Conversation

@faizer1989

Copy link
Copy Markdown

Summary

  • Passes onSpawn: ctx.onSpawn to the runChildProcess call in execute.ts so Paperclip can track the Hermes child PID.

Problem

runChildProcess was called without onSpawn, so the opts.onSpawn callback in @paperclipai/adapter-utils/server-utils.js was never invoked. As a result, Paperclip never called persistRunProcessMetadata, and heartbeat_runs.process_pid stayed NULL for every Hermes run.

This broke the orphan-process reaper's liveness check — without a PID, the reaper couldn't verify if the Hermes child was still alive. Combined with the missing hermes_local entry in SESSIONED_LOCAL_ADAPTERS (separate Paperclip PR), any Hermes run exceeding 5 minutes was falsely declared process_lost.

Verified

Live on ao-sh-derper: every historical Hermes run (including the successful 39-second AUT-19 run from 2026-04-23) showed process_pid = NULL.

Related

  • Sister fix: add hermes_local to SESSIONED_LOCAL_ADAPTERS in paperclipai/paperclip (separate PR)
  • Paperclip issue: AIW-185

runChildProcess was called without onSpawn, so Paperclip never received
the child PID via persistRunProcessMetadata. heartbeat_runs.process_pid
stayed NULL for every Hermes run, breaking the orphan-process reaper
liveness check.

Verified on ao-sh-derper: every historical Hermes run (including the
39-second AUT-19 run from 2026-04-23) showed process_pid = NULL.

Refs: AIW-185
pinsleepe pushed a commit to Pixel-Nomad-Global/hermes-paperclip-adapter that referenced this pull request May 27, 2026
Rebuilds dist/ after merging 10 upstream PRs:
  NousResearch#138 gate session persistence on success + drop legacy regex
  NousResearch#116 session-codec format validation
  NousResearch#102 unwrap Paperclip {type,value} env entries
  NousResearch#99  wire onSpawn for PID tracking
  NousResearch#96  add missing providers + prepare script (skip -Q disable + env dup)
  NousResearch#139 default model fallback to auto
  NousResearch#141 read wake metadata from ctx.context not ctx.config
  NousResearch#135 swap python3 pipes for jq in DEFAULT_PROMPT_TEMPLATE
  NousResearch#118 use PAPERCLIP_API_URL from adapter env in prompt
  NousResearch#122 make task closeout conditional on genuine completion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@liransmartlighthouse

Copy link
Copy Markdown

Independent confirmation of this bug + fix from a separate deployment.

We hit this exact issue running hermes_local agents under a live Paperclip server (a multi-agent fleet). Same root cause described here: execute() never forwards ctx.onSpawn to runChildProcess, so heartbeat_runs.process_pid is never persisted (stays NULL). On any run slower than the reconcile/reaper window, Paperclip loses the in-memory handle, has no PID to verify liveness, marks the run failed/process_lost, and auto-retries it once — orphaning the still-live Hermes child (which keeps consuming the model and can collide on shared session/HOME state).

We applied the identical one-line change (onSpawn: ctx.onSpawn in the runChildProcess opts) as a local patch and verified end-to-end:

  • run.processPid is now persisted,
  • slow runs are no longer falsely marked process_lost,
  • no more orphaned / auto-retried Hermes children.

Confirmed present in published 0.2.1, 0.3.0, and current main (onSpawn appears 0× in src/server/execute.ts). As you note, hermes_local being in SESSIONED_LOCAL_ADAPTERS is the sister Paperclip-side piece; with that in place, this PID-reporting gap is the only remaining cause. This bites real multi-agent deployments — a merge here would be appreciated. Thanks for the clean writeup; of the open PRs, #99 mirrors our analysis most closely.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants