Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions argoproj/openclaw/configmap-claude-settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: claude-settings
namespace: openclaw
data:
settings.json: |
{
"permissions": {
"defaultMode": "acceptEdits",
"allow": [
"Read",
"Glob",
"Grep",
"Bash(git *)",
"Bash(gh *)",
"Bash(ghq *)",
"Bash(gwq *)",
"Bash(mkdir *)",
"Bash(touch *)",
"Bash(cp *)",
"Bash(mv *)",
"Bash(rm *)",
"Bash(ls *)",
"Bash(cat *)",
"Bash(head *)",
"Bash(tail *)",
"Bash(find *)",
"Bash(grep *)",
"Bash(sed *)",
"Bash(awk *)",
"Bash(sort *)",
"Bash(uniq *)",
"Bash(wc *)",
"Bash(diff *)",
"Bash(chmod *)",
"Bash(ln *)",
"Bash(curl *)",
"Bash(tar *)",
"Bash(xargs *)",
"Bash(dirname *)",
"Bash(basename *)",
"Bash(tee *)",
"Bash(codex *)",
"Bash(docker *)",
"Bash(bb *)",
"Bash(man *)",
"Bash(apt-get *)",
"Bash(apt *)",
"Bash(bash /home/node/.claude/skills/xai-x-search/scripts/search.sh *)",
"Bash(bash /home/node/.claude/skills/xai-web-search/scripts/search.sh *)",
"WebFetch",
"mcp__grafana__*"
]
},
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": ["--transport", "stdio", "--disable-write"]
}
}
}
9 changes: 8 additions & 1 deletion argoproj/openclaw/deployment-openclaw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ spec:
DOTFILES_DIR=/home/node/ghq/github.com/boxp/dotfiles
# Symlink individual dotfiles into .claude instead of replacing
# the entire directory, to preserve Dockerfile's config.json
# and settings.json (trustedWorkspaces, allowedCommands).
# and ConfigMap-mounted settings.json.
CLAUDE_DIR=/home/node/.claude
if [ -d "$DOTFILES_DIR/.claude" ]; then
for item in "$DOTFILES_DIR/.claude"/* "$DOTFILES_DIR/.claude"/.*; do
Expand Down Expand Up @@ -211,6 +211,10 @@ spec:
- name: data
mountPath: /home/node/.codex
subPath: codex
- name: claude-settings
mountPath: /home/node/.claude/settings.json
subPath: settings.json
readOnly: true
# Config manager sidecar: periodically syncs ConfigMap to PVC
# so that OpenClaw's chokidar file watcher detects changes and
# hot-reloads configuration without Pod restart.
Expand Down Expand Up @@ -395,6 +399,9 @@ spec:
- name: openclaw-config
configMap:
name: openclaw-config
- name: claude-settings
configMap:
name: claude-settings
- name: gh-wrapper
configMap:
name: gh-wrapper
Expand Down
1 change: 1 addition & 0 deletions argoproj/openclaw/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ resources:
- external-secret.yaml
- external-secret-litellm.yaml
- configmap-openclaw.yaml
- configmap-claude-settings.yaml
- configmap-gh-wrapper.yaml
- configmap-litellm.yaml
- deployment-openclaw.yaml
Expand Down
58 changes: 58 additions & 0 deletions docs/project_docs/T-20260315-001/plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# T-20260315-001: Daily Morning Research 用承認設定修正

## 背景

`daily-morning-trend-research` cron ジョブが 2026-03-11 以降 6 日間連続で承認ブロックされ、
完全に機能停止していた。

## 原因

`/home/node/.claude/settings.json` の `permissions.allow` に以下が不足:

1. `Bash(bash /home/node/.claude/skills/xai-x-search/scripts/search.sh *)` — X検索スクリプト実行
2. `Bash(bash /home/node/.claude/skills/xai-web-search/scripts/search.sh *)` — Web検索スクリプト実行
3. `WebFetch` — はてなブックマーク等の外部 URL 取得

cron 実行時はインタラクティブな承認応答ができないため、全データソースへのアクセスがブロックされていた。

## 修正内容(v2: ConfigMap-only)

### 前案(v1: deployment 起動時パッチ)の問題点

- `deployment-openclaw.yaml` の起動スクリプトに `node -e` でインラインJavaScriptを埋め込み、
`settings.json` を動的にパッチしていた
- deployment の責務が過剰(起動スクリプトが設定管理を担うべきではない)
- `settings.json` の内容が Docker イメージ内とパッチスクリプトの2箇所に分散
- パッチの前後で settings.json の内容が不透明(Git diff で最終状態が見えない)

### v2: ConfigMap-only アプローチ

`settings.json` 全体を ConfigMap (`configmap-claude-settings.yaml`) として定義し、
Deployment の volumeMount で `/home/node/.claude/settings.json` に直接マウントする。

**変更ファイル:**
- `configmap-claude-settings.yaml` (新規): settings.json の全内容を静的に定義
- `deployment-openclaw.yaml`: `node -e` パッチを削除、ConfigMap の volumeMount を追加
- `kustomization.yaml`: 新しい ConfigMap リソースを追加

**追加する権限:**
- `Bash(bash /home/node/.claude/skills/xai-x-search/scripts/search.sh *)`
- `Bash(bash /home/node/.claude/skills/xai-web-search/scripts/search.sh *)`
- `WebFetch`

## 設計判断

- **ConfigMap-only で成立する理由**: `settings.json` は Docker イメージに bake されていたが、
内容は静的な設定であり、ConfigMap として外部化する方が GitOps の原則に合致する。
ConfigMap の volumeMount (subPath) で直接ファイルをマウントするため、
起動スクリプトでの動的パッチは不要。
- **dotfiles symlink の `settings.json` 除外は維持**: ConfigMap マウントされたファイルが
dotfiles によって上書きされることを防ぐ安全策として、既存の case 除外をそのまま残す。
- **最小権限の原則**: `Bash(bash *)` のような広範なパターンではなく、
特定のスクリプトパスのみを許可。

## リスク

- スキルスクリプトのパスが変更された場合、ConfigMap の更新が必要
- Docker イメージ内の settings.json と ConfigMap の内容が乖離する可能性があるが、
volumeMount が優先されるため実害はない
Loading