fix(codex): preserve daemon env in tool commands#2948
Open
YOMXXX wants to merge 1 commit into
Open
Conversation
|
@YOMXXX is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes Codex agent task subprocesses losing the daemon-injected Multica context. The daemon already passes
MULTICA_SERVER_URL,MULTICA_TOKEN,MULTICA_WORKSPACE_ID,MULTICA_AGENT_ID, andMULTICA_TASK_IDinto the Codex app-server process, but Codex applies its own shell environment policy when running model-requested commands. If the tool subprocess runningmultica issue comment adddoes not receive those variables, the CLI can fall back to user config or fail withNo server configured, causing agent replies to be attributed as a member instead of the agent.This keeps the server-side impersonation protection intact:
resolveActorstill requires bothX-Agent-IDand a validX-Task-ID. The fix is to startcodex app-serverwith-c shell_environment_policy.inherit=allso tool commands inherit the daemon task environment that the Multica CLI uses to add the agent headers.Related Issue
Closes #2944
Type of Change
Changes Made
server/pkg/agent/codex.go: append a Codex config override that lets shell/tool subprocesses inherit the daemon environment.server/pkg/agent/codex_test.go: add a regression test that locks the daemon env inheritance override at the end of the Codex app-server args, so a user custom arg cannot accidentally override it.How to Test
cd server && go test ./pkg/agent -run TestBuildCodexArgsLetsToolSubprocessesInheritDaemonEnvcd server && go test ./pkg/agentcd server && go test ./...Checklist
apps/web/features/landing/i18n/) and relevant docs (apps/docs/content/docs/)apps/docs/content/docs/developers/conventions.zh.mdx(terminology, mixed-rule fortask/issue/skill)AI Disclosure
AI tool used: Codex
Prompt / approach:
Investigated #2944 from the reporter's symptom back through the Multica identity chain: daemon env injection -> Codex app-server launch ->
multicaCLI header injection -> serverresolveActor. The server correctly requiresX-Agent-ID+X-Task-ID, so the fix stays on the Codex process boundary instead of weakening actor validation. Used TDD: added a failingbuildCodexArgsregression test first, then appended the Codex shell environment policy override and ran targeted plus full backend tests.Screenshots (optional)
N/A — backend/daemon runtime behavior only.