Repository navigation
Conversation
… scoping (#80) Reduce per-turn latency + tokens for Havaya app-user sessions while keeping Telegram/owner prompts byte-identical (all changes flow through app-only code paths): - New "app" PromptMode: drops CLI quick-ref / self-update / model-aliases / docs / silent-replies / heartbeats / owner-identity (privacy) but KEEPS Reply-Tags/ Messaging/Voice (unlike "minimal"). Telegram/owner stay on "full". - App-only bootstrap shaping (resolveBootstrapFilesForRun → applyAppBootstrapVariants): excludes boilerplate (TOOLS/MEMORY/HEARTBEAT/IDENTITY/USER) and prefers lean <name>.app.md variants when present (AGENTS.app.md/SOUL.app.md). Originals untouched. - Per-agent appSkills allowlist: new field on BOTH agent-defaults and agent-entry schemas + resolveAppSkillsAllowlist(cfg, agentId) = entry.appSkills ?? agents.defaults.appSkills (defaults-fallback precedent; works for life's defaults-only config). limitAppSkills takes the caller-resolved allowlist → never global. - Shared resolveAppPromptContext helper consumed by BOTH attempt.ts and compact.ts so the run + compaction paths can't drift (app user id, "app" mode, scoped skills); agent id resolved up front, before skill filtering. Implements PR #77 plan (rev4). APP_PROFILE render-slot + bootstrap memoization deferred to the caching increment (no token/latency payoff until Venice caching lands). Tests: app PromptMode drop/keep + full byte-identical control; resolveAppSkillsAllowlist defaults-only + per-agent isolation; applyAppBootstrapVariants exclude/swap; limitAppSkills allowlist. tsgo + oxlint clean. Co-authored-by: Liran Peretz <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
cryptolir
left a comment
There was a problem hiding this comment.
Review for Claude on cryptolir/openclaw#82 at 7a071aa.
Findings:
- [P1]
applyAppBootstrapVariantstreats every.app.mdread failure as “variant absent” and falls back to the full canonical bootstrap file. Missing variants may be a valid fallback, butEACCES,EISDIR,ELOOP, symlink/TOCTOU failures, or a broken deploy mean the app-safe variant exists but is unusable; silently serving fullAGENTS.md/SOUL.mdto app sessions can re-expand or disclose prompt context in prod with no signal. Please only fall back on true absence (ENOENT/ENOTDIR) and fail closed or warn/throw for other errors, with tests for unreadable/directory/symlink-loop variants.
Everything else I checked looks sound: the :app: gate matches the intended app key shapes, resolveAppPromptContext keeps run/compact parity, and appSkills is resolved per session agent instead of globally.
| const variantName = file.name.replace(/\.md$/i, ".app.md"); | ||
| if (variantName !== file.name) { | ||
| try { | ||
| const content = await fs.readFile(path.join(resolvedDir, variantName), "utf8"); |
There was a problem hiding this comment.
[P1] This catch treats every read failure as “no variant” and then falls back to the full canonical bootstrap file. That is fine for a genuinely absent .app.md, but if AGENTS.app.md / SOUL.app.md exists and is unreadable, a directory, a symlink loop, or hits a TOCTOU error, app sessions silently receive the full non-app file. Please distinguish ENOENT/ENOTDIR from other errors and fail closed or surface the problem instead of leaking/re-expanding the prod prompt.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a071aa382
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // App-user sessions only: drop boilerplate files and prefer lean `<name>.app.md` variants. | ||
| // Telegram/owner sessions skip this entirely → their assembled prompt is byte-identical. | ||
| if (isAppUserSession(sessionKey)) { | ||
| bootstrapFiles = await applyAppBootstrapVariants(bootstrapFiles, params.workspaceDir); |
There was a problem hiding this comment.
Reapply app bootstrap filtering after hooks
When an app session has the bundled bootstrap-extra-files hook enabled, applying applyAppBootstrapVariants here is not enough because applyBootstrapHookOverrides runs afterwards; that hook appends recognized files and only re-applies filterBootstrapFilesForSession, so configured extras such as IDENTITY.md, USER.md, TOOLS.md, or MEMORY.md are injected back into app prompts after this app-only exclusion. This breaks the privacy/no-op guarantee for app sessions in deployments that use bootstrap extras; enforce the app exclusions/.app.md swap on the post-hook file list as well.
Useful? React with 👍 / 👎.
cryptolir
left a comment
There was a problem hiding this comment.
Follow-up review for Claude on cryptolir/openclaw#82 at 7a071aa.
Confirming the automated Codex P2 as real:
- [P2] App bootstrap shaping currently runs before
applyBootstrapHookOverrides, and the hook-returned file list then flows straight into APP_PROFILE/build-context assembly. That means any bootstrap hook that appends canonicalTOOLS.md,MEMORY.md,USER.md,IDENTITY.md, or fullAGENTS.md/SOUL.mdcan bypass the app-only exclusions and.app.mdswap. Please re-apply app bootstrap shaping, or a stricter post-hook app sanitizer, after hooks for app sessions; add a regression test with a hook that injects one excluded file and one file with an.app.mdvariant.
…on unreadable .app.md (#83) 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: Liran Peretz <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
|
Both findings fixed in #83 (squash → main |
… 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]>
7a071aa382) and is live in prod on thelifegatewayv2026.06.20.1. Base = #80's pre-merge parent (80e54c12ad); head = the merged commit. Merging this would only affect the throwawayreview/increment-a-basebranch, nevermain.Why this PR
#80 shipped on a "finalize on test evidence" call —
tsgo+oxlint+ 22 unit tests + a healthy boot, but no adversarial code review. This surfaces the live code so Codex can hunt what tests don't.What the diff does (all gated to
:app:sessions → Telegram/owner byte-identical)"app"PromptMode (system-prompt.ts): drops CLI-ref/self-update/model-aliases/docs/silent-replies/heartbeats/owner-identity; keeps reply-tags/messaging/voice.workspace.tsapplyAppBootstrapVariants, called inbootstrap-files.tswhenisAppUserSession): excludes TOOLS/MEMORY/HEARTBEAT/IDENTITY/USER; prefers lean<name>.app.mdcontent.appSkillsallowlist:types.agents.ts+types.agent-defaults.ts+zod-schema.*+resolveAppSkillsAllowlist(agent-scope.ts, defaults-fallback);limitAppSkillstakes the caller-resolved allowlist.resolveAppPromptContexthelper (app-prompt-context.ts) consumed byattempt.ts+compact.ts.Please focus review on (what the unit tests do NOT cover)
isAppUserSession/(?:^|:)app:/vs real keysapp:<ns>:<userId>:<conv>; any way an app session is missed (→ silent no-op) or a non-app session is wrongly matched (→ behavior change)..app.mdcontent swap — malformed/partial variant files, mtime/TOCTOU races, symlink/path issues inapplyAppBootstrapVariants; failure modes (does a bad variant degrade gracefully to the full file, or throw the turn?).## User Identityfor app sessions: anything still leaking owner/Telegram context into an app prompt? Any excluded file whose loss changes safety behavior?attempt.tsvscompact.tsboth routing throughresolveAppPromptContext; any divergence under compaction or odd session keys.appSkillson both strict schemas; any validation-rejection or merge-precedence edge case (entry.appSkills ?? defaults.appSkills).Companion design plan for the next phase (caching) is the separate review-only PR #81.