Conversation
…ment
taskMulticaEnvironment now maps five claim fields into the daemon-owned
task env: MULTICA_SQUAD_ID / MULTICA_SQUAD_NAME / MULTICA_INITIATOR_ID /
MULTICA_INITIATOR_NAME / MULTICA_INITIATOR_EMAIL. Each is set only when
the claim carries a value, so "no squad or initiator" (autopilot runs,
direct member tasks) stays distinguishable from empty. They are
daemon-owned like the rest of the MULTICA_ namespace: isBlockedEnvKey
already drops any such key from agent custom_env.
Tools inside a task (git hooks, MCP gateways) can now record who a run
is for — commit authorship, On-behalf-of trailers, audit logs — without
an extra GET /api/agents/{id}/tasks round-trip at startup. Delegated
member tasks still export whatever the claim carries; filling
squad_id/squad_name server-side for delegated tasks is a separate,
server-side change.
Fixes multica-ai#9002
Generated-by: GLM-5.3-Flash (ZCode)
|
@ggbdpq is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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?
Export the squad and initiator identity that the claim payload already carries into the daemon-owned task environment, so tools inside a task (git hooks, MCP gateways) can record who a run is for without an extra API round-trip.
taskMulticaEnvironment(server/internal/daemon/daemon.go) now sets, only when the claim carries a value:MULTICA_SQUAD_IDTask.SquadIDMULTICA_SQUAD_NAMETask.SquadNameMULTICA_INITIATOR_IDTask.InitiatorIDMULTICA_INITIATOR_NAMETask.InitiatorNameMULTICA_INITIATOR_EMAILTask.InitiatorEmailThinking path
The daemon already injects
MULTICA_AGENT_ID/MULTICA_TASK_ID/MULTICA_AGENT_NAME, but a task that wants its squad or initiator must callGET /api/agents/{id}/taskswith its own token and find its own row — an extra startup round-trip coupled to an endpoint shape. The claim payload already holds all five fields, so the daemon is one mapping away.Unset-vs-empty matters: an autopilot run has no initiator and a direct member task has no squad, and consumers (commit authorship,
On-behalf-oftrailers, audit logs,${MULTICA_SQUAD_NAME:-}in MCP headers) need to tell that apart from an empty value. So each variable is set only when the claim value is non-empty. Ownership needs no new mechanism:isBlockedEnvKeyalready drops everyMULTICA_key from agentcustom_env, and a test asserts the new IDs survive a forgingcustom_env.Delegated member tasks still export whatever the claim carries —
squad_idis only set when a squad was the picker. Fillingsquad_id/squad_nameserver-side for delegated tasks (thedelegated_from_task_idwalk) is a separate server-side change the daemon needs no knowledge of.Docs: the task-environment table in
daemon-runtimes.mdxgains the five rows (IDs under Integration contract, display names and email under Informational, mirroring the existing agent ID/name split), synced to the zh/ja/ko/fr locales.Related Issue
Closes #9002
Type of Change
Changes Made
server/internal/daemon/daemon.go:taskMulticaEnvironmentmaps the five squad/initiator claim fields into the task env, each only when non-empty.server/internal/daemon/daemon_test.go:TestTaskMulticaEnvironmentExportsSquadAndInitiator(red before the fix; also assertscustom_envcannot override the new IDs) andTestTaskMulticaEnvironmentOmitsAbsentSquadAndInitiator(locks the unset contract).apps/docs/content/docs/daemon-runtimes{,.zh,.ja,.ko,.fr}.mdx: five new rows in the task-environment table.How to Test
go test -p 2 -run TestTaskMulticaEnvironment ./internal/daemon/— all three task-env tests pass; the exports test fails on the parent commit.go test -p 2 -run 'TestIsBlockedEnvKey|TestLayerCustomEnv|TestConfigureCodexTaskShellEnvironment|TestCodexShellAuthorizedCustomEnvNamesUsesDaemonBlocklist|TestTaskScopedAuthToken' ./internal/daemon/— env-adjacent groups stay green.go build ./internal/daemon/ ./internal/cli/.All of the above ran locally on Windows (the touched tests are pure unit tests, no database). The
internal/daemonpackage has pre-existing Windows-only failures elsewhere in the package, unchanged by this diff; CI is the authority for those.gofmtchecked clean on both Go files via a CRLF-stripped probe (Windows checkout).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: GLM-5.3-Flash (ZCode)
Prompt / approach: Verified the issue's code pointers against the current tip first, wrote the failing tests before the implementation, then kept the mapping minimal and mirrored the docs across the four locales. Commit carries the
Generated-by: GLM-5.3-Flash (ZCode)trailer.