Skip to content

fix: symlink telegram state into openclaw-data#981

Open
WuKongAI-CMU wants to merge 2 commits intoNVIDIA:mainfrom
WuKongAI-CMU:fix/975-telegram-state
Open

fix: symlink telegram state into openclaw-data#981
WuKongAI-CMU wants to merge 2 commits intoNVIDIA:mainfrom
WuKongAI-CMU:fix/975-telegram-state

Conversation

@WuKongAI-CMU
Copy link
Copy Markdown
Contributor

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

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 verification tests to ensure Telegram state handling in the container is configured correctly.
  • Chores

    • Improved container setup for Telegram state: dedicated writable storage and consistent ownership/permissions to ensure reliable persistence and access.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

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: c02b8022-37da-46a0-9975-dea0619d1af1

📥 Commits

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

📒 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 prepares a writable Telegram state directory at /sandbox/.openclaw-data/telegram, sets its ownership to sandbox:sandbox, and creates a symlink /sandbox/.openclaw/telegram pointing to it. A new Vitest test verifies these Dockerfile steps and their relative ordering.

Changes

Cohort / File(s) Summary
Dockerfile Configuration
Dockerfile
Creates /sandbox/.openclaw-data/telegram, chown -R sandbox:sandbox that path, removes any existing /sandbox/.openclaw/telegram, and symlinks /sandbox/.openclaw/telegram/sandbox/.openclaw-data/telegram; retains subsequent chown root:root /sandbox/.openclaw and find/chmod steps.
Test Coverage
test/dockerfile-telegram-state.test.js
Adds Vitest assertions that read Dockerfile and check for: creation and recursive ownership of /sandbox/.openclaw-data/telegram, presence of ln -sfn /sandbox/.openclaw-data/telegram /sandbox/.openclaw/telegram, and that the symlink step appears before the chown root:root /sandbox/.openclaw locking step.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nudged a link where roots once stood,
A tiny tunnel to make writes good,
State now hops where sandbox can play,
Tests keep mischief well at bay,
Hooray — permissions saved the day!

🚥 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 summarizes the main change: creating a symlink for the Telegram state directory into openclaw-data, which is the core fix for issue #975.
Linked Issues check ✅ Passed The PR addresses all coding objectives from #975: creates writable Telegram state directory at /sandbox/.openclaw-data/telegram with sandbox:sandbox ownership, establishes symlink before locking, and adds regression tests to prevent drift.
Out of Scope Changes check ✅ Passed All changes are directly in scope: Dockerfile modifications implement the symlink fix, and the new test file validates the Dockerfile layout to prevent regressions as required by #975.
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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

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

@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
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

@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.

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.

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

1 participant