Skip to content
Merged
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
6 changes: 4 additions & 2 deletions bin/setup-macos-factory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,18 @@ install_launch_agent() {
domain="gui/$(id -u)"
mkdir -p "$agent_dir" "$(dirname "$UPDATE_LOG")"
candidate="$(mktemp "$agent_dir/.$LAUNCH_AGENT_LABEL.XXXXXX")"
python3 - "$candidate" "$setup_bin" <<'PY'
# A start failure before agents-update opens its log (e.g. an unreadable entry) is otherwise lost.
python3 - "$candidate" "$setup_bin" "$(dirname "$UPDATE_LOG")/launchd-stderr.log" <<'PY'
import plistlib
import sys

target, update = sys.argv[1:]
target, update, stderr_log = sys.argv[1:]
value = {
'Label': 'com.kite.agents-update',
'ProgramArguments': ['/bin/bash', update],
'StartCalendarInterval': {'Hour': 2, 'Minute': 0},
'RunAtLoad': False,
'StandardErrorPath': stderr_log,
}
with open(target, 'wb') as handle:
plistlib.dump(value, handle, sort_keys=False)
Expand Down
8 changes: 4 additions & 4 deletions bin/update-grok-community-overlay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# 工場は接続だけを所有し、更新処理は各製品の正規入口へ委ねる。
set -euo pipefail

DESKTOP_ROOT="${GROK_COMMUNITY_DESKTOP:-$HOME/Developer/grok-build-vscode}"
AFK_ROOT="${GROK_COMMUNITY_AFK:-$HOME/Developer/afkpilot}"
DESKTOP_ROOT="${GROK_COMMUNITY_DESKTOP:-$HOME/Developer/grok-build-desktop-kitepon}"
AFK_ROOT="${GROK_COMMUNITY_AFK:-$HOME/Developer/afkpilot-kitepon}"
PUSH_REQUESTED=false

usage() {
Expand All @@ -14,8 +14,8 @@ update-grok-community-overlay — 両製品の正規更新入口を呼ぶ
update-grok-community-overlay --push

環境変数:
GROK_COMMUNITY_DESKTOP 既定: ~/Developer/grok-build-vscode
GROK_COMMUNITY_AFK 既定: ~/Developer/afkpilot
GROK_COMMUNITY_DESKTOP 既定: ~/Developer/grok-build-desktop-kitepon
GROK_COMMUNITY_AFK 既定: ~/Developer/afkpilot-kitepon

更新・検証・pushの契約は、各repoの scripts/update-overlay.sh が所有する。
EOF
Expand Down
6 changes: 3 additions & 3 deletions docs/factory-grok-build-community-overlay.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

| 面 | 工場の作業ディレクトリ | repo | 工場との接続 |
|---|---|---|---|
| Desktop overlay | `~/Developer/grok-build-vscode` | `kitepon/grok-build-desktop-kitepon` | 各席のDesktopとAFKへのuplink |
| AFK Pilot | `~/Developer/afkpilot` | `kitepon/afkpilot-kitepon` | main-serverの公開relay |
| Desktop overlay | `~/Developer/grok-build-desktop-kitepon` | `kitepon/grok-build-desktop-kitepon` | 各席のDesktopとAFKへのuplink |
| AFK Pilot | `~/Developer/afkpilot-kitepon` | `kitepon/afkpilot-kitepon` | main-serverの公開relay |

どちらも自作コア製品ではなく、単独repoの制御をdotagentsへ移さない。

## 製品側の正本

- Desktop overlay: `grok-build-vscode/KITEPON.md`、`docs/desktop.md`、`docs/desktop-update-spec.md`
- Desktop overlay: `grok-build-desktop-kitepon/KITEPON.md`、`docs/desktop.md`、`docs/desktop-update-spec.md`
- AFK Pilot: `afkpilot/docs/repositories.md`、`docs/CICD.md`、`deploy/kitepon/README.md`

製品の操作や障害対応では、上記の製品文書を直接読む。この文書へ手順や可変設定を複製しない。
Expand Down
2 changes: 1 addition & 1 deletion docs/feature-map/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| 所有する入口・実関数 | 入力・完了点 | 失敗・保持 |
| --- | --- | --- |
| `setup-macos-factory.sh:run_setup` | OS/command/Node/docker/gh読取確認→backup/git identity/toolchain→config→install→LaunchAgent→更新配送→verify | set-eで停止。先行導入/configを全体rollbackしない。Grok未loginはconfig適用をskip |
| 同`install_launch_agent` | 毎日02:00、RunAtLoad=false、agents-update入口。plist lint/既登録照会/内容比較/登録読戻し | 差替えは旧plist backup、必要時bootout。bootstrap失敗で復元を試みる。復元も成功保証ではなく、最終読戻し失敗は停止 |
| 同`install_launch_agent` | 毎日02:00、RunAtLoad=false、agents-update入口、StandardErrorPath=更新log隣の`launchd-stderr.log`(log open前の起動失敗を残す)。plist lint/既登録照会/内容比較/登録読戻し | 差替えは旧plist backup、必要時bootout。bootstrap失敗で復元を試みる。復元も成功保証ではなく、最終読戻し失敗は停止 |
| 同`run_factory_update` | 以前のreport IDと新batchを固定しagents-update --setup、同batch log/fresh report/receipt/製品集合を検査 | 更新子の非0、log/receipt不在/不一致は失敗。古い成功票や画面反映で代替しない |
| `setup-linux-factory.sh`と`setup-linux-workstation-factory.sh` | 実際のファイルは`setup-linux-factory.sh`と`setup-linux-workstation-factory.sh`。server/linux役割をcommonへexec | workstationだけ旧dotagentから正規pathへ条件付き移動して再exec。WSL再導入はしない |
| `setup-linux-common.sh:run_setup` | 前提→GitHub認証→runner/SSH→backup/git identity/enrollment/toolchain→config/install→cron→更新配送→verify | variant/OS拒否。途中失敗までのOS/package/config/接続stateは残る。server verifyは配送後にreadinessを検査 |
Expand Down
3 changes: 2 additions & 1 deletion tests/install/setup-macos-factory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ find "$HOME_DIR/Archives" -name 'com.kite.agents-update-pre-macos-setup-*' -type
|| fail '変更前LaunchAgentをbackupしない'
[ "$(grep -Fc 'launchctl bootout ' "$CALLS")" -eq 1 ] || fail '旧LaunchAgentの停止が一度でない'
[ "$(grep -Fc 'launchctl bootstrap ' "$CALLS")" -eq 1 ] || fail 'LaunchAgentの登録が一度でない'
python3 - "$HOME_DIR/Library/LaunchAgents/com.kite.agents-update.plist" "$HOME_DIR/.local/bin/agents-update" <<'PY'
python3 - "$HOME_DIR/Library/LaunchAgents/com.kite.agents-update.plist" "$HOME_DIR/.local/bin/agents-update" "$HOME_DIR/.local/state/agents-update/launchd-stderr.log" <<'PY'
import plistlib
import sys

Expand All @@ -317,6 +317,7 @@ with open(sys.argv[1], 'rb') as handle:
assert value['Label'] == 'com.kite.agents-update'
assert value['ProgramArguments'] == ['/bin/bash', sys.argv[2]]
assert value['StartCalendarInterval'] == {'Hour': 2, 'Minute': 0}
assert value['StandardErrorPath'] == sys.argv[3]
PY
grep -Fq 'apply-codex-config --apply' "$CALLS" || fail 'Codex設定を適用しない'
grep -Fq 'apply-claude-config --apply' "$CALLS" || fail 'Claude設定を適用しない'
Expand Down
Loading