fix(core): add LARKSUITE_CLI_FORCE_LOCAL escape hatch for inherited Agent env#1445
fix(core): add LARKSUITE_CLI_FORCE_LOCAL escape hatch for inherited Agent env#1445nguyenngothuong wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR implements a workspace detection escape hatch by introducing the ChangesAgent/Hermes Context Escape Hatch
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…gent env Agent path variables such as HERMES_HOME / OPENCLAW_HOME are user-facing and get exported into shell profiles, so they are inherited by every child process. Unrelated automation that merely inherits HERMES_HOME was routed into the Hermes workspace and refused to use its valid local lark-cli config, failing with "hermes context detected but lark-cli is not bound to it" (issue larksuite#1405). DetectWorkspaceFromEnv now honors LARKSUITE_CLI_FORCE_LOCAL == "1" as a priority-0 escape hatch that forces WorkspaceLocal, overriding every Agent signal without requiring the inherited variable to be unset. The agent "not bound" hint now mentions this escape hatch so operators hitting the wall can discover it.
95bf478 to
17a2dc2
Compare
|
Thanks for the PR and the clear root-cause notes — the analysis of where the signal comes from is genuinely helpful. The bind-path part needs no change. On For the escape hatch, I don't think we should merge it. Here's the reasoning. "Context detected but not bound" is not a bug — it's how the isolation is meant to work. The real question is why A permanent Two smaller points:
I've left guidance on the issue for the reporter on how to scope the variable. Thanks again for the careful work. |
Summary
Fixes #1405.
Agent path variables such as
HERMES_HOME/OPENCLAW_HOMEare user-facing and get exported into shell profiles, so they are inherited by every child process — not just Agent subprocesses. Any unrelated automation that merely inheritsHERMES_HOMEis routed into the Hermes workspace and refuses to use its valid locallark-cliconfig, failing with:{ "ok": false, "error": { "type": "config", "subtype": "not_configured", "message": "hermes context detected but lark-cli is not bound to it" } }This implements option 3 from the issue: a documented way to force normal local config mode without unsetting the inherited variable.
Change
DetectWorkspaceFromEnvnow honorsLARKSUITE_CLI_FORCE_LOCAL == "1"as a priority-0 escape hatch that returnsWorkspaceLocal, overriding every Agent signal. The check uses the same strict== "1"convention asOPENCLAW_CLI/HERMES_QUIET/LARK_CHANNEL, and the env-var naming matches the existingLARKSUITE_CLI_CONFIG_DIR.The agent "not bound" hint now mentions the escape hatch so operators who hit the wall can discover it.
Notes
HERMES_HOME" part of the issue appears already addressed onmain:resolveHermesEnvPath()(cmd/config/binder.go) already respectsHERMES_HOME. This PR targets the remaining root cause — false-positive workspace detection.OPENCLAW_CLI, downgradingHERMES_HOMEto a secondary signal) if maintainers prefer that direction.Tests
workspace_test.gocovering override-of-HERMES_HOME, override-of-all-signals, strict== "1"parsing (true/0ignored), and the no-op case.go build ./...,gofmt,go vet, andgo test ./internal/core/...+ the e2e config suite pass locally.Summary by CodeRabbit
New Features
Documentation
Tests