Repository navigation
fix(sessions): inherit agent bootstrap outside workspace - #125675
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 18, 2026, 3:19 AM ET / 07:19 UTC. ClawSweeper reviewWhat this changesThe PR makes configured agent bootstrap files, memory guidance, and skill snapshots available when a session executes from a separate folder or managed worktree. Merge readiness⛔ Blocked by patch quality or review findings - 9 items remain Keep open: the patch leaves non-sandboxed embedded runs without a skill snapshot loading skills from the execution folder, contrary to its configured-agent workspace invariant. The prior release-owned changelog finding also remains unresolved. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherEmbedded runs execute tools in a session-selected folder, while agent bootstrap files and skills define the configured agent’s identity. The Codex plugin consumes that prepared context to build native-harness instructions. flowchart LR
A[Configured agent workspace] --> B[Bootstrap and skills]
C[Session execution folder] --> D[Embedded agent run]
B --> D
D --> E[Codex prompt context]
D --> F[Tool execution]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +32, Tests +106, Docs +1. Total +139 across 16 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Make unsandboxed fallback skill discovery derive its source from bootstrapWorkspaceDir, preserve sandbox materialization and execution CWD, remove the release-owned changelog entry, and prove the split in a real external-session run. Do we have a high-confidence way to reproduce the issue? Yes—source inspection shows that an external embedded run without skillsSnapshot reaches fallback skill resolution rooted at effectiveWorkspace, not bootstrapWorkspaceDir. Is this the best way to solve the issue? No—the workspace split is only partially propagated; the fallback skill owner must follow the configured agent workspace too. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against abd4f6712c12. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…5675) * fix(sessions): inherit agent bootstrap outside workspace * fix(sessions): layer execution-dir project context over agent bootstrap --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Sessions executing outside the configured agent workspace (spawned cwd / managed worktrees) lost the agent's bootstrap identity (
AGENTS.md,SOUL.md,IDENTITY.md,USER.md,MEMORY.md) and skills, inheriting the execution folder's files as if they were the agent's own.Why This Change Was Made
The fix splits two concerns that were previously one variable:
bootstrapWorkspaceDir)AGENTS.mdis layered after agent bootstrap so repo instructions still apply (matches the Codex global-then-projectAGENTS.mdmodel; verified againstcodex-rs/codex-home/src/instructions/mod.rs,codex-rs/core/src/agents_md.rs,codex-rs/core/src/context/user_instructions.rs,codex-rs/core/src/thread_manager.rsuser_instructions_for_spawn,codex-rs/ext/skills/src/host_roots.rs@ upstream32a383c0ba)On the native Codex harness, the execution folder's
AGENTS.mdis not re-injected — native project-doc discovery owns it (invariant enforced + commented inextensions/codex/src/app-server/attempt-context.ts). Fallback skill discovery is anchored to the configured agent workspace in all four production callers (attempt, compaction, CLI, commands prompt) so snapshot and fallback paths agree; the param was renamedskillsAnchorWorkspaceto make the contract explicit.Accepted trade-off (commented): the agent-workspace
AGENTS.mdrides the turn-scoped developer-instructions channel on Codex, so native Codex subagents in external-cwd sessions don't inherit it. ACODEX_HOME-materialized global-instructions alternative is a named follow-up.Skipped in this PR (follow-up): merging execution-dir
skills/into the OpenClaw skill snapshot — snapshot/refresh/cold-hydration/sandbox materialization are single-root contracts; a clean change needs a multi-root snapshot owner.User Impact
Agents keep their identity, standing instructions, memory guidance, and skills when working in worktrees or other folders, while still honoring the visited repo's
AGENTS.md. Canonical (same-folder) sessions are byte-identical to before (regression-tested).Evidence
pnpm tsgo+ test-type lanes +pnpm build: pass.OPENCLAW_STATE_DIR, mock-openai provider, realsessions.create({cwd})→spawnedCwd→chat.sendflow):{ "agentAgentsPresent": true, "projectAgentsPresent": true, "projectAfterAgent": true, "forbiddenSoulAbsent": true, "agentSkillPresent": true, "execSkillAbsent": true, "canonicalNoDuplicate": true }Canary markers were planted in both dirs; the captured provider payloads show agent
AGENTS.md+SOUL.mdfirst, executionAGENTS.mdafter, executionSOUL.mdabsent, agent skills only. Canonical A==B control session showed no duplicate injection. Verified independently against the raw/debug/requestscapture.Rank-up moves from the 2026-08-18 review
/tmpstate dir, no credentials involved.