Repository navigation
feat: Kind demo for the moca-delegate-task skill - #544
Conversation
The skill now delegates with contextctl ctx pack and mocactl workloads/spawn/subagents/get instead of the remote_task.py helper. Adds a Claude Code permission allowlist example so delegation keeps working when auto mode's classifier is unavailable, and updates the internal flow diagram to the merged design. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Jeremy Cohn <[email protected]>
setup.sh brings up MOCA P6 and Context Service on a local Kind cluster with port mappings and the mock model; run.sh runs the skill's flow on a small example repo: pack, create a workload, a read-only task and a --writable fix task, results, delete. The mock model gains two scripts for the demo, with tests. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Jeremy Cohn <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Summary
Stacked on #535. I reviewed only the incremental commit 54dd5bd (git diff 3833ac9 54dd5bd); #535's own content is covered in that PR's review. It adds a Kind demo (setup.sh/run.sh/kind.yaml/example_repo) plus two mock-model scripts with tests. I checked the scripts' assumptions against main 4c93f24, and they hold: deploy/k8s/setup.sh honours SH_SOURCE_ONLY and exposes main/print_access/KIND_CLUSTER/KIND_CONTEXT; the token mint mirrors deploy/k8s/smoke.sh; auth.json's expiresAt is in seconds as apiTokenValid expects; the moca-context-service ConfigMap/Secret keys match supervisor.yaml; and the Context Service manifest at the pin uses IfNotPresent. Ports bind to 127.0.0.1 only, and secrets go through stdin. Nothing blocking.
Author: moonlight16 (MEMBER — maintainer)
Areas reviewed: Shell, YAML (Kind/NetworkPolicy), JS (mock model), shell tests, Docs
Agent/IDE config (.claude/.vscode): none
Commits: 2 commits (#535's + this one), all signed-off: yes
CI status: passing (incl. deploy-scripts, microvm-gates, k8s-kind-e2e)
Drafted with AI assistance (github-pr-review skill); reviewed by a maintainer before posting.
| TIMEOUT="${DEMO_TIMEOUT:-300}" | ||
| OUT="$STATE_DIR/results/$(date +%Y%m%dT%H%M%S)" | ||
| # The demo-only login setup.sh wrote, and the contextctl it built. | ||
| export XDG_CONFIG_HOME="$STATE_DIR/config" XDG_STATE_HOME="$STATE_DIR/state" |
There was a problem hiding this comment.
suggestion — mocactl gives SH_CONTROL_PLANE_URL and SH_HARNESS_URL priority over config.json (config.ts:192-194). A MOCA user who has these exported for their real deployment, which is likely the audience for this demo, gets one of two outcomes. Either not logged in (loadAuth drops auth.json because its controlPlaneUrl doesn't match), or, with only SH_HARNESS_URL set, run.sh sends the demo token and uploads to their real harness. Exporting the demo URLs here and at setup.sh:210 (export SH_CONTROL_PLANE_URL=http://127.0.0.1:8090 SH_HARNESS_URL=http://127.0.0.1:8080) would isolate the demo the same way XDG_CONFIG_HOME already does.
| [ "$#" -eq 1 ] || die 'usage: setup.sh --delete' | ||
| need kind | ||
| kind delete cluster --name "$CLUSTER" | ||
| rm -rf "$STATE_DIR" |
There was a problem hiding this comment.
suggestion — STATE_DIR comes from MOCA_DEMO_STATE, so a mis-set value (MOCA_DEMO_STATE=~, a typo pointing at an existing directory) gets rm -rf'd by --delete. A cheap guard: have setup.sh write a marker (e.g. $STATE_DIR/.moca-kind-demo) when it creates the directory, and have --delete refuse to remove a directory without it.
| # so it is sourced (SH_SOURCE_ONLY=1) and pointed at this one; its port-forward hints are dropped. | ||
| ( | ||
| # shellcheck source-path=SCRIPTDIR source=../../../deploy/k8s/setup.sh | ||
| SH_SOURCE_ONLY=1 . "$REPO_ROOT/deploy/k8s/setup.sh" |
There was a problem hiding this comment.
nit — the demo now relies on deploy/k8s/setup.sh internals (SH_SOURCE_ONLY, main, print_access, and the KIND_CLUSTER/KIND_CONTEXT globals being read late rather than at parse time). Nothing in deploy/k8s/tests protects that, so a refactor there could break this demo silently. A one-line comment next to KIND_CLUSTER=moca in deploy/k8s/setup.sh pointing here would help.
| fi | ||
| [ -f "$cs_src/deploy/context-service.yaml" ] || die "Context Service $CONTEXT_SERVICE_REF has no deploy/context-service.yaml" | ||
| log "Context Service $CONTEXT_SERVICE_REF" | ||
| if [ "$BUILD_ARG" != --skip-build ]; then |
There was a problem hiding this comment.
nit — with --skip-build on a fresh cluster, dev.local/context-service:demo was never loaded, so the pod sits in ErrImagePull until the 3-minute rollout status times out. Either check for the image on the node first (docker exec "$node" crictl inspecti "$CS_IMAGE") and die with a hint, or document that --skip-build assumes an earlier --build/default run.
- Say plainly that the skill's allowlist removes Claude Code's prompt before uploads, and offer a restricted set that keeps ctx pack and workloads create on prompt. - Pack into a temporary directory outside the working tree and delete it at cleanup. - Name POST /v1/runs in the flow doc and diagram. - Pin the demo's SH_CONTROL_PLANE_URL and SH_HARNESS_URL so a real deployment's exported URLs never receive the demo token or upload. - --delete removes only a marked demo state directory; --skip-build fails fast when the Context Service image is missing. - deploy/k8s/setup.sh honours KIND_CLUSTER (default moca). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Jeremy Cohn <[email protected]>
Follow-up to #535 (moca-delegate-task rebuilt on mocactl), stacked on it; the diff includes #535 until it merges. Shows #517 (seed sandbox files before a leaf runs) end to end on a local Kind cluster, using only the skill's commands and no
kubectl cp.skills/moca-delegate-task/demo/setup.shcreates a Kind cluster with port mappings (no port-forwarding), installs MOCA P6 (the Kubernetes deployment indeploy/k8s) with the mock model, builds Context Service from a pinned commit, and turns workloads on. It logs in with a demo-only token kept apart from your ownmocactllogin, and restores your kube context.--deletetears it all down.run.shpacksexample_repo/, creates a workload, runs a read-only task (the agent starts in the repo, can't write, runs./test.sh) and a--writabletask (fixes the bug,./test.shpasses), shows the results, and deletes the workload.Tested on a fresh Kind cluster: all six checks pass, the workload's Context and PVC are removed, and no context files are left in the sandboxes.
🤖 Generated with Claude Code