-
Notifications
You must be signed in to change notification settings - Fork 126
feat(starry-kernel): add unshare, procfs namespace files, and claw-code tests #1031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
9066a22
feat(claw-code): implement unshare() syscall with CLONE_NEWUSER support
MuZhao2333 39590a0
feat(claw-code): implement /proc/self/{uid_map,gid_map,setgroups}
MuZhao2333 46d0804
test(claw-code): add uid_map procfs test case
MuZhao2333 5fafdac
test(claw-code): add gid_map procfs test case
MuZhao2333 3b2abdc
test(claw-code): add setgroups procfs test case
MuZhao2333 dad6958
chore(claw-code): fix cargo fmt formatting in proc.rs
MuZhao2333 7d6a15b
feat(claw-code): implement /proc/[pid]/cgroup
MuZhao2333 c5fba8e
test(claw-code): add integration test (smoke + diagnostic)
MuZhao2333 a2b5fd4
test(claw-code): switch integration test to Rust pipeline
MuZhao2333 98b4236
fix(claw-code): add [workspace] to integration test Cargo.toml
MuZhao2333 84eeb82
fix(claw-code)switch to x86
MuZhao2333 fa97f0e
fix(claw-code) epoll
MuZhao2333 c91d945
test(claw-code): add robust-01..11, use env vars for API credentials
MuZhao2333 5360b12
style: merge use alloc imports in mount.rs for rustfmt compliance
MuZhao2333 731f60e
chore: remove riscv64 config from claw-code integration test
MuZhao2333 2e16bfe
fix(claw-code): correct rootfs path in run-local.sh
MuZhao2333 c1d1e48
test(claw-code): add robust-12 multi-agent test
MuZhao2333 9cdcea7
fix(mount): remove extra closing brace from rebase conflict resolution
MuZhao2333 9aa4f46
style: fix cargo fmt formatting
MuZhao2333 fe600ad
feat(claw-code): register claw-code as StarryOS app
MuZhao2333 b5e1edd
fix(claw-code): gracefully skip tests when CLAW_API_KEY is not set
MuZhao2333 9ca6eac
merge: resolve CI workflow conflicts with upstream/dev
MuZhao2333 987833f
fix(claw-code): address PR review — add x86_64 goal configs, document…
MuZhao2333 6c294e1
style: fix cargo fmt formatting
MuZhao2333 6f09ca7
fix(claw-code): fix TOML escape in x86_64 goal config regex
MuZhao2333 f5206a4
fix(claw-code): use rcore-os/tgoskits release URL for claw binary
MuZhao2333 3d1ad39
fix(claw-code): use debugfs injection in prebuild.sh matching run-loc…
MuZhao2333 2f365f0
fix(claw-code): build claw from source instead of downloading pre-bui…
MuZhao2333 aeb0b88
fix(build-claw): remove broken CARGO_HOME override
MuZhao2333 dff6e82
fix(claw-code): use MuZhao2333/claw-code fork for source build
MuZhao2333 902d90d
fix(build.rs): parse only the last line of build-claw.sh output as bi…
MuZhao2333 eb43ed9
fix(claw-code): build claw in release mode to reduce binary size (avo…
MuZhao2333 ef4791b
fix(claw-code): add missing driver features to app build config, fix …
MuZhao2333 ac40e72
merge: resolve conflicts with upstream/dev (namespace rewrite)
MuZhao2333 ecc284b
fix(clippy): remove duplicate unshare match arm from merge
MuZhao2333 e530cfb
chore: retrigger CI
MuZhao2333 8a5f878
chore: retrigger CI
MuZhao2333 355ff4d
chore: retrigger CI
MuZhao2333 8a57c0f
fix(claw-code): review fixes — connect uid/gid_map to UserNamespace, …
MuZhao2333 bc1e0a4
fix(clippy): remove unnecessary mut on nsproxy
MuZhao2333 9a435f1
chore: retrigger CI
MuZhao2333 b84bb73
chore: retrigger CI
MuZhao2333 5020a13
fix(claw-code): split is_root into uid_mapped/gid_mapped, add syscall…
MuZhao2333 75b548b
fix(goal-04): rewrite setgroups test — do EPERM check before unshare,…
MuZhao2333 0250bf1
fix(goal-04): write newline-terminated strings to setgroups to match …
MuZhao2333 7d56acc
chore: retrigger CI
MuZhao2333 22ea44c
chore: retrigger CI
MuZhao2333 52e9f41
chore: retrigger CI
MuZhao2333 79efab0
chore: retrigger CI
MuZhao2333 f7e0e2c
chore: retrigger CI
MuZhao2333 587a0a5
fix(prebuild): remove manual rootfs copy — app framework handles it
MuZhao2333 b92c954
fix(prebuild): fall back to default workspace paths when STARRY_* env…
MuZhao2333 9094341
fix(qemu): add -snapshot to avoid rootfs write lock conflict
MuZhao2333 75d868d
fix(prebuild): inject claw into both alpine and claw-code rootfs imag…
MuZhao2333 93b2d97
fix(qemu): add file.locking=off to avoid QEMU file lock conflict
MuZhao2333 8c1a006
fix(prebuild): delete and recreate claw-code rootfs to avoid stale QE…
MuZhao2333 5afb33f
chore: retrigger CI
MuZhao2333 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| target = "x86_64-unknown-none" | ||
| env = {} | ||
| log = "Warn" | ||
| features = [ | ||
| "ax-hal/x86-pc", | ||
| "qemu", | ||
| "ax-driver/plat-static", | ||
| "ax-driver/virtio-blk", | ||
| "ax-driver/virtio-net", | ||
| "ax-driver/virtio-gpu", | ||
| "ax-driver/virtio-input", | ||
| "ax-driver/virtio-socket", | ||
| ] | ||
| plat_dyn = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| CLAW_REPO="https://github.com/MuZhao2333/claw-code" | ||
| CACHE_DIR="${CLAW_CACHE_DIR:-${HOME}/.cache/claw-code-build}" | ||
| CLAW_SRC="$CACHE_DIR/repo" | ||
| TARGET="x86_64-unknown-linux-musl" | ||
| CLAW_BIN="$CACHE_DIR/claw" | ||
|
|
||
| WORKSPACE="${STARRY_WORKSPACE:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}" | ||
| ROOTFS_DIR="$WORKSPACE/tmp/axbuild/rootfs" | ||
| OVERLAY="${STARRY_OVERLAY_DIR:-$WORKSPACE/tmp/axbuild/starry-app/claw-code/overlay}" | ||
|
|
||
| echo "=== 1. Build claw from source ===" | ||
| if [ -f "$CLAW_BIN" ]; then | ||
| echo "claw binary cached at $CLAW_BIN" | ||
| else | ||
| mkdir -p "$CACHE_DIR" | ||
| rustup target add "$TARGET" 2>/dev/null || true | ||
| if [ ! -d "$CLAW_SRC" ]; then | ||
| echo "Cloning $CLAW_REPO ..." | ||
| git clone --depth 1 "$CLAW_REPO" "$CLAW_SRC" | ||
| fi | ||
| echo "Building claw for $TARGET (this may take a while)..." | ||
| ( | ||
| cd "$CLAW_SRC/rust" | ||
| cargo build --workspace --release --target "$TARGET" --target-dir "$CACHE_DIR/target" | ||
| ) | ||
| cp "$CACHE_DIR/target/$TARGET/release/claw" "$CLAW_BIN" | ||
| chmod +x "$CLAW_BIN" | ||
| echo "claw binary built: $CLAW_BIN" | ||
| fi | ||
|
|
||
| echo "=== 2. Prepare rootfs ===" | ||
| # The app framework may have created rootfs-x86_64-claw-code.img via fs::copy, | ||
| # which can leave a stale lock preventing QEMU from opening it. Delete the | ||
| # target first, then copy the base alpine image afresh. | ||
| ALPINE_IMG="$ROOTFS_DIR/rootfs-x86_64-alpine.img" | ||
| CLAW_IMG="$ROOTFS_DIR/rootfs-x86_64-claw-code.img" | ||
| rm -f "$CLAW_IMG" | ||
| cp "$ALPINE_IMG" "$CLAW_IMG" | ||
|
|
||
| echo "=== 3. Inject claw into rootfs ===" | ||
| inject_claw() { | ||
| local img="$1" | ||
| echo " injecting into $img ..." | ||
| debugfs -w "$img" -R "rm /usr/bin/claw" 2>/dev/null || true | ||
| debugfs -w "$img" -R "write $CLAW_BIN /usr/bin/claw" | ||
| debugfs -w "$img" -R "sif /usr/bin/claw mode 0100755" | ||
| } | ||
| inject_claw "$ALPINE_IMG" | ||
| inject_claw "$CLAW_IMG" | ||
|
|
||
| echo "Injected claw into rootfs" | ||
|
|
||
| # Place a marker so the overlay is never empty (app framework requires it). | ||
| mkdir -p "$OVERLAY" | ||
| touch "${OVERLAY}/.claw-injected" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| timeout = 0 | ||
| shell_prefix = "root@starry:" | ||
| uefi = false | ||
| to_bin = false | ||
| success_regex = [] | ||
| fail_regex = [] | ||
|
|
||
| args = [ | ||
| "-nographic", | ||
| "-m", "512M", | ||
| "-device", "virtio-blk-pci,drive=disk0", | ||
| "-drive", "id=disk0,if=none,format=raw,file=${workspace}/tmp/axbuild/rootfs/rootfs-x86_64-claw-code.img,file.locking=off", | ||
| "-device", "virtio-net-pci,netdev=net0", | ||
| "-netdev", "user,id=net0", | ||
| "-snapshot", | ||
| ] | ||
|
|
||
| shell_init_cmd = """ | ||
| export HOME=/root | ||
| export USER=root | ||
| export SHELL=/bin/sh | ||
| export TERM=xterm-256color | ||
| export PATH=/usr/local/bin:/usr/bin:/bin:/sbin | ||
| cat <<'STARRY_CLAW_USAGE' | ||
|
|
||
| StarryOS Claw interactive shell is ready. | ||
|
|
||
| 常用命令: | ||
| claw | ||
|
|
||
| 退出 QEMU: | ||
| Ctrl-a x | ||
|
|
||
| STARRY_CLAW_USAGE | ||
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.