Skip to content

feat(harness): SessionStart stage timing instrumentation (#897 step 1) - #991

Merged
jinon86 merged 1 commit into
mainfrom
feat/897-memory-timing
Aug 6, 2026
Merged

feat(harness): SessionStart stage timing instrumentation (#897 step 1)#991
jinon86 merged 1 commit into
mainfrom
feat/897-memory-timing

Conversation

@jinon86

@jinon86 jinon86 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

#897 1단계 — 계측 선행

이슈 본문의 순서 고정 지시(① 계측 → ② 검색 병렬화 → ③ 통합 렌더 → ④ setup.sh)에 따른 첫 PR입니다. 최적화 전에 정적 가설을 실측으로 검증합니다.

변경

load-memory.sh가 실행마다 body-free JSON 1행$CCC_STATE_DIR/memory-timing.jsonl에 추가합니다:

{"ts":"","event":"SessionStart","total_ms":817,"stages":{"sources":2,"dynamic_budget":38,"search_local":501,"dedup":}}
  • 계측 단계: sources / dynamic_budget / search_local / search_recent / search_shared / search_legacy / merge / filter_wiki / dedup / render — 이슈가 지목한 직렬 검색 체인(최대 9초) 가설의 실측 포인트
  • EPOCHREALTIME 기반(프로세스 스폰 0), 기본 on, CCC_MEMORY_TIMING=0 옵트아웃
  • 로그 자체 상한(~256KiB 넘으면 최신 128KiB 유지), 고정 단계명+정수 ms만 — 메모리 본문·쿼리·경로 미기록
  • stdout(훅 JSON 계약)·exit 코드·주입 내용 무변경, 실패필open

검증

  • memory-hooks.test.sh 신규 7건(1행/실행, 단계 키, body-free, append, 옵트아웃 무기록) 포함 43/43
  • refresh-memory-freshness 15/15, ccc-memory.test.sh 131/131, bash -n + git diff --check 통과
  • 스코프 모드(audience private)에서는 scope state에 기록되는 것을 라이브 env로 확인

후속 (이 PR 범위 밖)

2단계(검색 병렬화/3초 전역 예산)·3단계(memory_render.py 통합)는 이 계측 데이터가 쌓인 뒤 진행. nunchi stale 비동기화는 #893, statusline은 #894 소유.

@jinon86
jinon86 requested a review from seoseo-ai as a code owner August 6, 2026 12:27

@seoseo-ai seoseo-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved after explicit operator authorization using the local seoseo-ai credential.

load-memory.sh now appends one body-free JSON line per run (fixed stage
names + integer ms + total) to $CCC_STATE_DIR/memory-timing.jsonl. This
validates the issue's static hypotheses — the serial local/recent/shared/
legacy search chain (up to 9s worst case) and the over-split render pipeline
— against real fleet data before step 2 (parallel search) and step 3
(unified render) land. Default on, CCC_MEMORY_TIMING=0 opts out; the log
self-bounds at ~256KiB; timing never touches stdout or the hook contract.
@jinon86
jinon86 force-pushed the feat/897-memory-timing branch from bf9827e to d300685 Compare August 6, 2026 13:01

@seoseo-ai seoseo-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved after explicit operator authorization using the local seoseo-ai credential.

@jinon86
jinon86 merged commit 006fa5f into main Aug 6, 2026
8 checks passed
@jinon86
jinon86 deleted the feat/897-memory-timing branch August 6, 2026 13:08
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