Repository navigation
perf(cli): skip absent gateway workspace dotenv - #119227
Conversation
* origin/main: test(qa): cover Canvas agent and node controls (#119047) fix(cli): avoid repeated migration scans during local agent turns (#119051) fix(gateway): keep agents list on prepared model facts (#119208) fix(telegram): retry update offset persistence fix(ci): accept profiled partial Kova gates (#119121)
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 10:33 AM ET / 14:33 UTC. ClawSweeper reviewWhat this changesThis PR avoids importing the CLI dotenv loader for gateway startup when the workspace has no Merge readinessNo actionable correctness or security finding on the exact head. Keep this maintainer-authored, maintainer-labeled PR open for CLI/gateway owner approval and completion of its exact-head checks. Priority: P3 Review scores
Verification
How this fits togetherThe CLI classifies an invocation and normally loads workspace and state environment files before dispatch. Gateway startup has a separate pre-bootstrap phase that selects trusted state/config environment files before it initializes the gateway. flowchart LR
A[CLI arguments] --> B[Gateway invocation check]
B --> C[Workspace dotenv check]
C --> D[CLI dotenv loader]
B --> E[Gateway pre-bootstrap]
E --> F[State and config dotenv]
F --> G[Gateway startup]
Decision needed
Why: The patch is source-consistent and well scoped, but this is a member-authored PR with the protected Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +6, Tests +82. Total +88 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain this command-boundary optimization, then land it after a CLI/gateway owner approves the exact behavior and the exact-head checks complete successfully. Do we have a high-confidence way to reproduce the issue? Yes. The no-workspace gateway path is deterministically covered in the exact-head test, and the PR body supplies an exact-head six-start Kova comparison; this read-only review did not execute tests. Is this the best way to solve the issue? Yes. Carrying the already-known gateway invocation fact to the CLI boundary skips the unnecessary dynamic import without moving state/config dotenv ownership out of gateway pre-bootstrap. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1aedd8f37e0b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
@clawsweeper re-review Refreshed onto exact current |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer owner decision: approved. I reviewed exact head Proceeding through the repository-native |
|
Merged via squash.
|
* origin/main: fix(agents): protect private memory in shared chats (#119198) perf(cli): skip absent gateway workspace dotenv (#119227) fix(agents): observe native provider prompt egress (#119219) fix(feishu): report bot identity retry failures (#102185) fix(memory): load configured providers for CLI search (#119186) fix(discord): count retained speech bytes test(discord): isolate exact speech overflow test(discord): cover exact speech overflow fix(discord): bound realtime exact speech
* origin/main: fix(agents): protect private memory in shared chats (#119198) perf(cli): skip absent gateway workspace dotenv (#119227) fix(agents): observe native provider prompt egress (#119219) fix(feishu): report bot identity retry failures (#102185) fix(memory): load configured providers for CLI search (#119186) fix(discord): count retained speech bytes test(discord): isolate exact speech overflow test(discord): cover exact speech overflow fix(discord): bound realtime exact speech
* perf(cli): skip absent gateway workspace dotenv * test(cli): cover gateway dotenv import boundary * test(cli): prove gateway dotenv stays lazy
* origin/main: fix(agents): protect private memory in shared chats (openclaw#119198) perf(cli): skip absent gateway workspace dotenv (openclaw#119227) fix(agents): observe native provider prompt egress (openclaw#119219) fix(feishu): report bot identity retry failures (openclaw#102185) fix(memory): load configured providers for CLI search (openclaw#119186) fix(discord): count retained speech bytes test(discord): isolate exact speech overflow test(discord): cover exact speech overflow fix(discord): bound realtime exact speech
What Problem This Solves
openclaw gateway runalways imported and ran the CLI dotenv loader, even whenthe workspace had no
.envfile. Gateway pre-bootstrap already ownsstate/config dotenv selection, so the common path paid an unnecessary dynamic
import and filesystem/env parsing cost.
Root Cause And Owner
The CLI invocation boundary selected the command but delegated dotenv loading
without carrying that command fact forward. As a result, gateway startup could
not skip global/state dotenv work that its pre-bootstrap path already owns.
The CLI invocation owner now decides whether global/state dotenv loading is
allowed:
.env;This is the best fix because it removes the work at the boundary that already
knows the command. Optimizing the dotenv module would still pay the dynamic
import, while skipping all gateway dotenv handling would break supported
workspace
.envbehavior.User Impact
Typical gateway startup no longer imports the CLI dotenv loader when no
workspace
.envexists. Workspace.env, state/config dotenv, CLI config, andpublic API behavior are unchanged.
Production LOC: +10/-4. Tests: +88/-6. No config/default surface changes.
ClawSweeper Resolution
main52954a1fa8f4d63914967a87f56ada21f5a0252e.d0ce3f8e314df58a35202631a8b6cb6006c1dde0.below replaces the earlier stale samples.
Verification
oxfmt --check: clean.oxlint: clean.git diff --check: clean.trufflehog: clean.Kova Evidence
Exact
mainrunkova-260804-135713-433310:cli.main.dotenvspan;readiness/health timing noise.
Exact PR-head run
kova-260804-140445-8c1576:cli.main.dotenvspan;post-ready health timing noise.
The claim is intentionally narrow: the gateway no-file path removes the exact
dotenv span in all observed starts. The noisy aggregate pass rate and wall time
are not used as performance claims.
No changelog entry: this is an internal startup optimization with no
user-facing contract change.