Skip to content

feat(termux-worker): owner decisions 1/3/4 — opt-in file, identity-lib stale, dry-run smoke (#2791) - #2933

Merged
seoseo-ai merged 3 commits into
mainfrom
feat/2791-termux-worker-owner-decisions
Nov 27, 2026
Merged

seoseo-ai merged 3 commits into
mainfrom
feat/2791-termux-worker-owner-decisions

Conversation

@seoseo-ai

Copy link
Copy Markdown
Collaborator

요약

#2791 후속입니다. 2026-11-27 오너 결정 5개 중 코드 변경이 필요한 1·3·4를 한 PR에 담았습니다(커밋 3개). 2·5는 지금 동작을 유지하고, 문서에 한 줄로 적었습니다.

결정별 변경

결정 1 — 노드별 opt-in을 파일로도 켤 수 있게 (scripts/ccc-self-update.sh)

  • operator 소유 파일 ~/.claude/self-update.native-supervisor-restart가 있으면 켜집니다.
  • 우선순위는 self-update.notify와 같습니다. env CCC_SELF_UPDATE_NATIVE_SUPERVISOR_RESTART가 비어 있지 않으면 env가 이깁니다. 0이면 파일이 있어도 꺼집니다. 비어 있거나 unset이면 파일이 결정합니다.
  • 헤더 주석과 docs/self-update.md(5c 단계, env 표)에 적었습니다. 에이전트는 이 파일을 쓰지 않습니다.

결정 3 — lib/a2a-supervisor-identity.sh 변경도 supervise stale로 감지 (scripts/lib/a2a-native-worker-stale.sh)

  • supervise 종류의 installed 시각은 스크립트와 identity lib 중 가장 늦은 시각입니다. 각 파일은 지금처럼 max(mtime, ctime)로 봅니다.
  • lib가 가장 최근에 바뀐 파일이면 줄에 changed=<lib 경로>를 붙입니다. 위치는 file= 앞이고, file=<스크립트>는 계속 마지막입니다. 그래서 health의 kind= 파싱과 self-update의 "kind=supervise "*" file=$own" 재기동 매칭은 바뀌지 않습니다.
  • lib가 없으면 무시합니다. installed=missing은 스크립트가 없을 때만 나옵니다.

결정 4 — 배포 dry-run에 handler smoke 포함 (scripts/a2a-termux-native-worker-deploy.sh)

  • dry-run도 --apply의 4단계 검사(build revision, artifact의 worker-artifact-rollout-guard.mjs --deployed, --smoke-cmd)를 실행합니다. 대상은 배포 후 worker root의 임시 preview입니다.
  • preview는 $TMPDIR 아래 mktemp -d에 만들고 EXIT trap으로 지웁니다. 구성은 다음과 같습니다.
    • live root에서 node_modules와 dist.bak*를 뺀 것(백업과 같은 범위)
    • dist/·scripts/·handlers/는 심링크를 따라가 실제 파일로 복사합니다. 그래서 심링크된 release dist/에 덮어쓰지 않습니다. 복사 뒤에도 심링크가 남아 있으면 거부합니다.
    • 그 위에 artifact를 덮어씁니다.
    • node_modules에는 artifact 패키지를 실제로 복사하고, 나머지 live 패키지는 심링크로 둡니다.
  • 검사가 실패하면 idle gate 전에 exit 20으로 끝나며, 아무것도 바꾸지 않습니다. --apply 경로는 같은 함수(pre_restart_checks)를 쓰도록 정리만 했고 메시지와 순서는 그대로입니다.

결정 2·5 — 코드 변경 없음: busy가 계속돼도 강제로 재기동하지 않습니다. hung 자식은 hung=N으로 보고만 합니다. docs/a2a-claude-worker.md에 한 줄로 적었습니다.

검증 (로컬, fresh clone)

suite 결과
scripts/a2a-termux-native-worker-health.test.sh PASS=59 FAIL=0 (+6)
scripts/ccc-self-update.test.sh PASS=504 FAIL=0 (+5)
scripts/a2a-termux-native-worker-deploy.test.sh PASS=47 FAIL=0 (+14)
scripts/a2a-termux-native-worker-restart.test.sh PASS=28 FAIL=0
scripts/a2a-termux-native-worker.test.sh PASS=57 FAIL=0

변이 테스트(red 확인):

  • 결정 3
    • lib를 비교 대상에서 빼면 health 2개 FAIL, self-update 1개 FAIL입니다.
    • changed= 출력을 없애면 health 2개 FAIL입니다.
  • 결정 1
    • 파일 검사를 무시하면 self-update 3개 FAIL입니다.
    • env 0이 파일을 이기지 못하게(OR) 바꾸면 1개 FAIL입니다.
  • 결정 4
    • dry-run 검사를 빼면 9개 FAIL입니다.
    • 검사를 live root에 돌리면 16개 FAIL입니다.
    • deploy dir을 심링크를 따라가지 않고 복사하면 1개 FAIL입니다(심링크된 dist/).
    • preview 정리를 빼면 4개 FAIL입니다.

정적 점검: shellcheck -S warning(변경한 셸 파일 6개), canon-node-name-scan.sh --repo-wide ok(baseline 일치), changelog_fragments.py check ok. changelog: changelog.d/2791-native-worker-owner-decisions.md

범위 밖 / 게이트

  • 이 PR은 노드에서 아무것도 실행하지 않습니다.
  • 머지는 따로 승인받습니다. opt-in 파일을 만드는 것, Termux 반영, 실배포(--apply)도 노드별로 각각 따로 승인받습니다.
  • 알려진 한계: preview의 미교체 node_modules 패키지는 live 패키지를 가리키는 심링크입니다. 그래서 smoke 명령이 node_modules에 쓰면 live에 반영됩니다(문서에 명시). 미교체 패키지가 교체된 workspace 패키지를 import하면, 실제 경로 기준으로 해석되므로 옛 버전이 잡힐 수 있습니다.

Refs #2791

🤖 Generated with Claude Code

jinon86 and others added 3 commits November 27, 2026 16:35
…rvise loop stale (#2791)

Owner decision 2026-11-27 (3): the supervise script sources
lib/a2a-supervisor-identity.sh at start-up, so for kind=supervise the
installed time is the latest of the script and that lib (each
max(mtime, ctime)). When the lib is the newest change the line carries
changed=<lib> before file=<script>, which stays last so the health
parser and the self-update restart match are unchanged. A missing lib
is ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner decision 2026-11-27 (1): ~/.claude/self-update.native-supervisor-restart
(exists -> on) is an operator-owned alternative to
CCC_SELF_UPDATE_NATIVE_SUPERVISOR_RESTART=1. The env var, when set and
non-empty, wins over the file (0 keeps a node off despite it) - the same
precedence as self-update.notify. Tests also cover a lib-only change
restarting through the file opt-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…temp preview (#2791)

Owner decision 2026-11-27 (4): the dry-run runs the same step-4 checks
as --apply (build revision, the artifact's rollout guard --deployed,
--smoke-cmd) against a preview of the post-deploy worker root in a
private mktemp dir that the EXIT trap removes. Deploy dirs are copied
dereferenced so a symlinked live dist/ is never written through;
unchanged node_modules packages are symlinks. Failure exits 20 before
the idle gate with nothing changed. Decisions 2 and 5 (no forced restart,
hung children only reported) are documented, not changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@seoseo-ai
seoseo-ai requested a review from jinon86 as a code owner November 27, 2026 07:36

@jinon86 jinon86 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after exact-head validation and fresh operator authorization using the relay-held jinon86 credential.

@seoseo-ai
seoseo-ai added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 0cf9dd6 Nov 27, 2026
17 checks passed
@seoseo-ai
seoseo-ai deleted the feat/2791-termux-worker-owner-decisions branch November 27, 2026 08:26
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.

2 participants