Skip to content

[feature] Support post-start init hook to restore ephemeral container state after pod restart #1241

Description

@mahu888

Summary

NemoClaw provides no mechanism to run user-defined initialization commands after a pod restart. Any tools installed in the container's writable layer (e.g. via apt install or npm install -g) are lost on every pod restart, requiring manual intervention each time.

Problem

NemoClaw runs openclaw-gateway inside a k3s sandbox pod backed by an overlay filesystem:

On pod restart, the writable layer is discarded and rebuilt from the image. NemoClaw's orchestrator only restarts the gateway process — it does not execute any user-defined setup steps.

This forces users who need additional tools (CLI utilities, npm packages, environment overrides) to maintain a manual restore script and run it after every restart.

Real-world impact

Examples of setup that must be repeated manually after every pod restart:

What Why needed
apt install ncal agent uses cal for calendar generation
npm install -g clawhub skill management CLI
npm config set cache /sandbox/.npm fix npm cache permissions for sandbox user
Writing /tmp/gw-env.sh override NEMOCLAW_INFERENCE_BASE_URL env injected by pod spec

Expected behavior

NemoClaw should support a post-start hook that runs automatically before (or just after) the gateway starts on every pod boot. For example:

Option A — init script file (lowest friction):

If this file exists, NemoClaw executes it inside the sandbox before starting the gateway.

Option B — openclaw.json lifecycle hooks:

Option C — k8s initContainer declared in the NemoClaw-managed pod spec, configurable via nemoclaw config.

Any of these would eliminate the need for users to maintain and manually trigger a restore script.

Workaround

Currently users must maintain a manual restore script and run it after every restart:

Environment

  • NemoClaw: v0.1.0
  • OpenShell: 0.0.16
  • Platform: AWS EC2 (Ubuntu 24.04)

Metadata

Metadata

Assignees

Labels

area: ciCI workflows, checks, release automation, or GitHub Actionsplatform: ubuntuAffects Ubuntu Linux environments

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions