Repository navigation
Conversation
Evidence: /tmp/codex0357_live_reload_baseline.json /tmp/codex0357_live_reload_after_add.json /tmp/codex0357_live_reload_after_remove.json /tmp/codex0357_hotreload_same_session.json /tmp/codex0358_pnpm_check.txt Scope: dev.7dea.ai/api-dev.7dea.ai only (no app.7dea.ai/api.7dea.ai)
Greptile SummaryThis PR fixes a long-lived session bug where workspace bootstrap files ( The equality helpers correctly cover all four Confidence Score: 5/5Safe to merge — the fix is correct, tests cover the new semantics, and the only open item is a P2 performance note about disk reads per turn. All findings are P2 (style/performance) with no correctness, data-integrity, or security concerns. The equality logic is complete and correct, session isolation is preserved, and the test suite adequately covers the changed behavior. No files require special attention. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/agents/bootstrap-cache.ts
Line: 31-37
Comment:
**Cache no longer avoids disk I/O**
`loadWorkspaceBootstrapFiles` now runs unconditionally on every call — reading up to 8 workspace files from disk per turn. Before this PR the cache short-circuited at the `Map` lookup, so subsequent turns paid O(1); now every turn pays O(disk reads), and the `Map` only preserves object-reference identity when content is unchanged.
For typical home-directory markdown files the OS page-cache keeps individual reads fast, but the semantics change is worth being explicit about: this is no longer a "load-once" cache; it is a "compare-on-every-access" refresh loop. If per-turn latency becomes a concern, a lightweight mtime-check or debounced TTL window (e.g. re-read at most once per N seconds) would restore disk-I/O avoidance without giving up change detection.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(agents): refresh bootstrap snapshot ..." | Re-trigger Greptile |
| const files = await loadWorkspaceBootstrapFiles(params.workspaceDir); | ||
| const existing = cache.get(params.sessionKey); | ||
| if (existing) { | ||
| if (existing && bootstrapSnapshotEquals(existing, files)) { | ||
| return existing; | ||
| } | ||
|
|
||
| const files = await loadWorkspaceBootstrapFiles(params.workspaceDir); | ||
| cache.set(params.sessionKey, files); | ||
| return files; |
There was a problem hiding this comment.
Cache no longer avoids disk I/O
loadWorkspaceBootstrapFiles now runs unconditionally on every call — reading up to 8 workspace files from disk per turn. Before this PR the cache short-circuited at the Map lookup, so subsequent turns paid O(1); now every turn pays O(disk reads), and the Map only preserves object-reference identity when content is unchanged.
For typical home-directory markdown files the OS page-cache keeps individual reads fast, but the semantics change is worth being explicit about: this is no longer a "load-once" cache; it is a "compare-on-every-access" refresh loop. If per-turn latency becomes a concern, a lightweight mtime-check or debounced TTL window (e.g. re-read at most once per N seconds) would restore disk-I/O avoidance without giving up change detection.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/bootstrap-cache.ts
Line: 31-37
Comment:
**Cache no longer avoids disk I/O**
`loadWorkspaceBootstrapFiles` now runs unconditionally on every call — reading up to 8 workspace files from disk per turn. Before this PR the cache short-circuited at the `Map` lookup, so subsequent turns paid O(1); now every turn pays O(disk reads), and the `Map` only preserves object-reference identity when content is unchanged.
For typical home-directory markdown files the OS page-cache keeps individual reads fast, but the semantics change is worth being explicit about: this is no longer a "load-once" cache; it is a "compare-on-every-access" refresh loop. If per-turn latency becomes a concern, a lightweight mtime-check or debounced TTL window (e.g. re-read at most once per N seconds) would restore disk-I/O avoidance without giving up change detection.
How can I resolve this? If you propose a fix, please make it concise.|
Maintainer handoff: this PR is intentionally narrow. It fixes a long-lived main-session reload issue where on-disk bootstrap/context file updates were not reflected on later turns without a fresh session. The change keeps the existing behavior surface small, adds focused regression coverage for same-session reload, and does not include any private/local workspace content. Current status:
Happy to adjust if you’d prefer a different reload boundary, but this should be ready for maintainer review/merge. |
|
@joshavant Friendly nudge when you have a moment: this PR is clean, CI is green, and the maintainer handoff summary is already in-thread above. #64871 |
Objective
Fix a long-lived session bug where on-disk workspace bootstrap/context updates were not reflected in subsequent turns for the same session unless the bootstrap snapshot was explicitly cleared or the session was reset.
Deploy-source proof
This change is for
openclaw/openclawand is based on the local reproduction and validation branchaimqwest_codex/0358-main-session-workspace-reloadpushed toaimqwest/openclaw. There is no deployment claim in this PR; the source proof is the code diff plus the local validation artifacts listed below.Problem
getOrLoadBootstrapFilescached workspace bootstrap files forever persessionKey. After the first turn, later turns in the same long-lived session reused that cached snapshot without checking whetherAGENTS.md,SOUL.md,MEMORY.md,TOOLS.md, or other bootstrap files had changed on disk.Root cause
The session bootstrap cache was keyed only by
sessionKeyand treated the first loaded file set as authoritative for the life of that session.loadWorkspaceBootstrapFilesalready has file-identity-aware reads, butbootstrap-cache.tsnever reloaded the file set to see whether it had changed.Fix
This keeps the session-local snapshot stable when nothing changed, while allowing same-session bootstrap refresh after on-disk workspace updates.
Tests
src/agents/bootstrap-cache.test.tsWhy scope is intentionally narrow
This PR only adjusts bootstrap snapshot refresh semantics and the directly related unit tests. It does not change workspace file discovery rules, hook behavior, session routing, or any product-specific workspace content.
Files changed
src/agents/bootstrap-cache.tssrc/agents/bootstrap-cache.test.tsValidation
pnpm exec vitest run --config vitest.config.ts src/agents/bootstrap-cache.test.ts src/agents/workspace.bootstrap-cache.test.ts— passpnpm build— passgit diff --check— passpnpm check— blocked by unrelated existing lint failures insrc/channels/plugins/config-writes.tson this checkout; see evidence fileEvidence files
/tmp/codex0357_live_reload_baseline.json/tmp/codex0357_live_reload_after_add.json/tmp/codex0357_live_reload_after_remove.json/tmp/codex0357_hotreload_same_session.json/tmp/codex0358_pnpm_check.txtScope statement
Focused runtime bug fix only. No AIMQWEST-private workspace content, no docs bundle, no unrelated refactors.
AI assistance