Skip to content

feat: The Librarian β€” shared read-only volumes for hatchlings#27

Open
dahifi wants to merge 1 commit intomainfrom
feat/librarian-shared-volumes
Open

feat: The Librarian β€” shared read-only volumes for hatchlings#27
dahifi wants to merge 1 commit intomainfrom
feat/librarian-shared-volumes

Conversation

@dahifi
Copy link
Copy Markdown
Owner

@dahifi dahifi commented Apr 3, 2026

Closes #18

What

Adds --library <path> flag to hatch.sh so hatchlings can mount shared reference materials as read-only volumes.

Changes

  • hatch.sh: New --library flag injects a :ro volume mount into the generated docker-compose.yml and persists the path in fleet.json. Warns (doesn't fail) if the path doesn't exist locally β€” it may exist on the remote deploy host.
  • fleet.sh: status output now shows library=<path> or library=none per instance.
  • test-hatch.sh: New assertions for compose mount presence and fleet.json library field.
  • README.md: Documents The Librarian pattern with usage examples.

Usage

./scripts/hatch.sh my-client --library /share/Container/shared-resources/my-client/

Produces:

volumes:
  - ./data:/home/openclaw/.openclaw:rw
  - /share/Container/shared-resources/my-client/:/home/openclaw/library:ro

Tests

All 48 tests pass (test-hatch.sh: 25, test-fleet.sh: 23).

Implements #18: hatchlings can mount shared reference materials as
read-only volumes via hatch.sh --library <path>.

- hatch.sh: --library flag adds :ro volume mount to docker-compose.yml,
  persists path in fleet.json, warns if path missing locally
- fleet.sh: status output shows library mount per instance
- test-hatch.sh: validates compose mount and fleet.json library field
- README.md: documents The Librarian pattern with usage examples
Copy link
Copy Markdown
Owner Author

@dahifi dahifi left a comment

Choose a reason for hiding this comment

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

Zephyr code review β€” PR #27 (The Librarian)

πŸ‘ Looks good to merge β€” clean, focused implementation.

What's good:

  • --library flag is optional and non-breaking β€” existing hatch.sh usage unchanged
  • Read-only mount (:ro) is the right default for shared resources
  • Warning-not-error when path doesn't exist locally is smart for remote deploy scenarios
  • fleet.json persistence means fleet.sh status can report library paths without Docker inspection
  • Tests cover both compose mount presence and registry field β€” solid coverage
  • README docs are clear with concrete examples
  • EOF β†’ EOF2 fix for nested heredocs is a good catch

E2E failure is pre-existing β€” container health check timeout affects both #26 and #27 but not earlier PRs. Likely an OC version or CI env change. The Build and Test workflow passes. Worth investigating separately (maybe the latest OC npm package changed its health endpoint behavior?).

Minor nit (non-blocking): The awk injection for the volume mount is fragile if the compose template ever changes the data mount line. A yq approach would be more robust, but it's fine for now given the template is controlled.

Ready for merge. 🚒

@dahifi
Copy link
Copy Markdown
Owner Author

dahifi commented Apr 3, 2026

🦞 Automated Review (Zephyr)

Local tests: 25/25 pass βœ…
Code review: Clean implementation.

Good details:

  • EOF β†’ EOF2 heredoc fix avoids variable interpolation conflicts
  • Warning-but-continue for missing library paths supports remote deploy workflow
  • Fleet registry tracks library path with proper null/empty handling
  • Read-only mount (:ro) is the right default for shared resources
  • Test cleanup properly removes test instance from fleet.json

CI note: E2E failure is container health timeout in GitHub Actions β€” unrelated to this PR (main branch E2E passes green). Transient CI env issue.

One minor suggestion (non-blocking): The awk injection for the volume mount assumes exact indentation match on the data volume line. If the template's whitespace ever changes, the mount won't inject. A more robust approach (yq or a sed anchor) could future-proof it. Not blocking β€” current approach works fine with the existing template.

Ready to merge. 🚒

Copy link
Copy Markdown
Owner Author

@dahifi dahifi left a comment

Choose a reason for hiding this comment

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

🦞 Automated review (Zephyr)

Tested locally β€” all tests pass (25/25 hatch, 23/23 fleet).

Summary: Adds --library PATH flag to hatch.sh that mounts a shared read-only volume at /home/openclaw/library. Path tracked in fleet.json, shown in fleet.sh status.

Code quality: Clean. Awk injection for compose mount is pragmatic, heredoc delimiter fix is correct, test coverage is solid including cleanup.

Minor suggestion for later: Add a negative test (hatch without --library β†’ no library mount in compose). Low risk.

Ready to merge. 🚒

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.

The Librarian β€” shared resource volumes for hatchlings

1 participant