Skip to content

fix: symlink telegram state into openclaw-data - #981

Closed
WuKongAI-CMU wants to merge 2 commits into
NVIDIA:mainfrom
WuKongAI-CMU:fix/975-telegram-state
Closed

WuKongAI-CMU wants to merge 2 commits into
NVIDIA:mainfrom
WuKongAI-CMU:fix/975-telegram-state

Conversation

@WuKongAI-CMU

@WuKongAI-CMU WuKongAI-CMU commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • precreate writable Telegram channel state under /sandbox/.openclaw-data/telegram
  • symlink /sandbox/.openclaw/telegram into .openclaw-data before locking .openclaw
  • add a regression test that keeps the Dockerfile layout from drifting

Fixes #975.

Summary by CodeRabbit

  • Tests

    • Added tests that verify the container’s Telegram state setup is present and applied in the correct order.
  • Chores

    • Improved container setup for Telegram state: creates dedicated writable storage, ensures correct ownership and permissions, and replaces any legacy path to provide more reliable persistence and access.

@coderabbitai

coderabbitai Bot commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1c3c7d33-d703-4e23-ab5e-fd71f16f00dc

📥 Commits

Reviewing files that changed from the base of the PR and between d630428 and c61f6bf.

📒 Files selected for processing (2)
  • Dockerfile
  • test/dockerfile-telegram-state.test.js
✅ Files skipped from review due to trivial changes (1)
  • test/dockerfile-telegram-state.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • Dockerfile

📝 Walkthrough

Walkthrough

The Dockerfile now pre-creates /sandbox/.openclaw-data/telegram, sets ownership to sandbox:sandbox, removes any existing /sandbox/.openclaw/telegram, and replaces it with a forced symlink to the new path. A Vitest file was added to validate presence and ordering of these Dockerfile steps.

Changes

Cohort / File(s) Summary
Dockerfile Configuration
Dockerfile
Create /sandbox/.openclaw-data/telegram, chown -R sandbox:sandbox on it, rm -rf /sandbox/.openclaw/telegram, ln -sfn /sandbox/.openclaw-data/telegram /sandbox/.openclaw/telegram, then reapply chown root:root /sandbox/.openclaw and existing find/chmod hardening.
Test Coverage
test/dockerfile-telegram-state.test.js
New Vitest reads Dockerfile and asserts presence of mkdir -p and chown -R for the data dir, presence and ordering of rm -rf /sandbox/.openclaw/telegram, ln -sfn .../telegram .../.openclaw/telegram, and that chown root:root /sandbox/.openclaw occurs after the symlink.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nudged a little data burrow neat and snug,
Linked its door so sandbox paws can tug,
I set the keys for friendly hands,
A tiny test ensures my plans,
Now the bot can hop and save with a hug!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: symlinking telegram state into a separate openclaw-data directory to resolve ownership/permission issues.
Linked Issues check ✅ Passed The code changes fully address issue #975 objectives: precreates writable telegram directory with correct ownership, symlinks it before locking, removes existing paths, and adds regression tests.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #975: Dockerfile modifications for directory setup/symlinking and a test file validating the fix and preventing regressions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Dockerfile`:
- Around line 137-139: The current RUN step uses ln -sfn
/sandbox/.openclaw-data/telegram /sandbox/.openclaw/telegram which will place a
symlink inside /sandbox/.openclaw/telegram if that path is an existing
directory; before creating the symlink remove or replace the destination
directory to ensure it is replaced atomically. Modify the RUN sequence around
mkdir/chown and the ln invocation to explicitly remove the existing target
(e.g., rm -rf or rmdir as appropriate) for /sandbox/.openclaw/telegram before
calling ln -sfn so the symlink reliably replaces any prior directory or file.

In `@test/dockerfile-telegram-state.test.js`:
- Around line 17-19: The test currently only checks DOCKERFILE includes the
symlink string "ln -sfn /sandbox/.openclaw-data/telegram
/sandbox/.openclaw/telegram" but not that it appears before the locking step;
update the test to assert ordering by finding the index of that symlink string
in DOCKERFILE and the index of the lock command used in the Dockerfile (e.g.,
the locking token you use elsewhere such as "flock /sandbox/.openclaw.lock" or
the exact lock command present) and expect symlinkIndex < lockIndex so the
symlink line occurs before the lock line.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 31692211-b723-4917-9fe0-77a1104e7df8

📥 Commits

Reviewing files that changed from the base of the PR and between 5c269c1 and 0cdbac5.

📒 Files selected for processing (2)
  • Dockerfile
  • test/dockerfile-telegram-state.test.js

Comment thread Dockerfile Resolved
Comment thread test/dockerfile-telegram-state.test.js Resolved
@WuKongAI-CMU

Copy link
Copy Markdown
Contributor Author

Addressing the two CodeRabbit comments in b292eae:

  • remove any existing /sandbox/.openclaw/telegram path before creating the symlink so the target is replaced instead of nested
  • tighten the Dockerfile regression test to assert the replacement and symlink happen before the .openclaw lock/setup step

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

@WuKongAI-CMU Sure! I'll kick off a fresh review to verify both fixes — the rm -rf guard before the symlink creation and the tightened ordering assertion in the Dockerfile regression test.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@WuKongAI-CMU

Copy link
Copy Markdown
Contributor Author

Checking in — this fixes Telegram state persistence across sandbox restarts by symlinking into openclaw-data. Mergeable with no conflicts. Ready for review whenever the team has bandwidth.

@wscurran wscurran added integration: telegram Telegram integration or channel behavior bug and removed integration: telegram Telegram integration or channel behavior labels Mar 30, 2026
@wscurran

Copy link
Copy Markdown
Contributor

✨ Thanks for submitting this fix with a detailed summary, it identifies a bug in the Telegram state handling and proposes a solution to symlink the state into openclaw-data, which could improve the stability and reliability of NemoClaw.

@wscurran wscurran added the integration: telegram Telegram integration or channel behavior label Mar 30, 2026
@WuKongAI-CMU
WuKongAI-CMU force-pushed the fix/975-telegram-state branch from b292eae to d630428 Compare April 2, 2026 04:44
@WuKongAI-CMU

Copy link
Copy Markdown
Contributor Author

Rebased this branch onto current main and force-pushed the refreshed head. Verification run on the refreshed branch: npm install --include=dev, then npm test -- test/dockerfile-telegram-state.test.js (2 passed).

@WuKongAI-CMU
WuKongAI-CMU force-pushed the fix/975-telegram-state branch from d630428 to c61f6bf Compare April 8, 2026 01:02
@WuKongAI-CMU

Copy link
Copy Markdown
Contributor Author

Closing — branch is stale (3 weeks old) and upstream has likely moved on. Will resubmit if still relevant.

@wscurran wscurran added bug-fix PR fixes a bug or regression and removed fix labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression integration: telegram Telegram integration or channel behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram channel setup fails: EACCES on /sandbox/.openclaw/telegram due to root-owned overlayfs layers

2 participants