Repository navigation
fix(life/app): enforce app bootstrap shaping after hooks + fail loud on unreadable .app.md (#82 review) - #83
Conversation
…on unreadable .app.md Codex review of #82 (the shipped Increment A code) found two real prod bugs: [P1] applyAppBootstrapVariants treated EVERY .app.md read failure as 'variant absent' and fell back to the full canonical file — so an existing-but-unusable variant (EACCES/EISDIR/ELOOP/TOCTOU/broken deploy) silently served the full AGENTS.md/SOUL.md to app sessions. Now only ENOENT/ENOTDIR (true absence) falls back silently; any other error warns loudly (thread a warn callback through resolveBootstrapFilesForRun). [P2] App bootstrap shaping ran BEFORE applyBootstrapHookOverrides, so a bootstrap hook (e.g. the bundled bootstrap-extra-files) could re-inject excluded files (TOOLS/MEMORY/USER/IDENTITY/HEARTBEAT) or full AGENTS/SOUL into an app prompt, bypassing the privacy/slimming guarantee. App shaping now runs AFTER hooks. Tests: unreadable (EISDIR) variant → fallback + warn; absent (ENOENT) → fallback no warn; e2e regression — a hook injecting an excluded file + a variant-backed file is sanitized post-hook for an app session. tsgo + oxlint clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ith #83 [P2] Phase 0 reads the NESTED cached-token field (usage.prompt_tokens_details .cached_tokens / usage.input_tokens_details.cached_tokens), not the nonexistent top-level usage.cached_tokens. [P2] Memo key covers all canonical bootstrap inputs (BOOTSTRAP/AGENTS/SOUL mtimes/hashes + sessionKey + promptMode + config version), not just .app.md variants. Memo span narrowed to load→filter only; applyAppBootstrapVariants now runs post-hook + un-memoized (matching shipped #83), so variant edits reflect automatically. Added an edit-canonical-file invalidation test. Still review-only. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
cryptolir
left a comment
There was a problem hiding this comment.
Post-merge review for Claude on cryptolir/openclaw#83 at 0e61a07.
Findings:
- [P1] The bad-variant path still serves the full canonical bootstrap file to app sessions. The PR now warns on non-
ENOENT/ENOTDIRerrors, but it then falls through and pushes the originalAGENTS.md/SOUL.mdcontent into the prompt for that same turn. That preserves the privacy/slimming failure from #82 whenever the app-safe variant exists but is unusable (EACCES,EISDIR,ELOOP, broken deploy, TOCTOU). Please fail closed for those errors: drop the canonical file, return a missing/empty safe placeholder, or throw/abort the turn. Update the EISDIR test to assert thatFULL AGENTSis not included, not just that a warning was emitted.
The P2 hook-order fix looks good: hooks now run before app shaping, and the e2e test covers an excluded hook-injected file plus a variant-backed canonical file.
| `falling back to full ${file.name} for this app session — fix the deploy`, | ||
| ); | ||
| } | ||
| // fall through → keep the canonical file |
There was a problem hiding this comment.
[P1] Warning is not enough here because the function still falls through to result.push(file) below, so the app user gets the full canonical bootstrap content on the bad-variant turn. For non-absence errors (EACCES/EISDIR/ELOOP/TOCTOU), fail closed by omitting/replacing the canonical file or aborting the turn, and make the EISDIR test assert that FULL AGENTS never enters the returned files.
… full canonical) (#84) Codex post-merge review of #83 (4537421648): the prior fix warned but still fell through to result.push(file), so an app session still received the FULL AGENTS.md/SOUL.md on a bad-variant turn — preserving the #82 privacy/slimming regression. Now a non-ENOENT/ENOTDIR variant read failure DROPS the file for that app session (fail-closed) instead of serving the canonical full file; warning still surfaces the broken deploy. ENOENT/ENOTDIR (genuinely absent) still falls back to canonical (correct for files with no variant). EISDIR test now asserts FULL AGENTS never enters the returned files. Also fixes a latent tsgo error in the #80 system-prompt.app-mode.test.ts (readonly as-const ownerNumbers). Co-authored-by: Liran Peretz <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
|
Fixed in #84 (squash → main |
Fixes the two findings from the Codex review of #82 (the shipped Increment A code, live on
life v2026.06.20.1).applyAppBootstrapVariantstreated every.app.mdread failure as "variant absent" → an existing-but-unusable variant (EACCES/EISDIR/ELOOP/TOCTOU/broken deploy) silently served the fullAGENTS.md/SOUL.mdto app sessions. Now onlyENOENT/ENOTDIR(true absence) falls back silently; any other error warns loudly (awarncallback is threaded throughresolveBootstrapFilesForRun).applyBootstrapHookOverrides, so a bootstrap hook (e.g. the bundledbootstrap-extra-files) could re-inject excluded files or fullAGENTS/SOULinto an app prompt, bypassing the privacy/slimming guarantee. Shaping now runs after hooks.Tests: unreadable (EISDIR) → fallback + warn; absent (ENOENT) → fallback no warn; e2e regression — a hook injecting an excluded file + a variant-backed file is sanitized post-hook for an app session.
tsgo+oxlintclean; Telegram/owner still byte-identical (app-gated).🤖 Generated with Claude Code