[maestro] Ensure objective_id is set for codex worker operating-chat requests - #809
Conversation
…requests Sentry PLATFORM-5 (operating_chat_objective_id_required) is thrown server-side by the Platform codex worker: its operating-chat / tool-execution endpoint requires objective_id on the request linkage when the surface is the platform-agent-runtime worker. The Maestro client treated objective_id as optional everywhere and never guaranteed it on the wire, and the trusted-tool env allowlist did not include the objective env vars, so the objective could be stripped before reaching the request linkage. Fixes: - shell-env.ts: add MAESTRO_OBJECTIVE_ID and MAESTRO_EVALOPS_OBJECTIVE_ID to PLATFORM_TRUSTED_TOOL_ENV_ALLOWLIST so the objective survives into the worker's trusted-tool subprocesses. - tool-execution-client.ts: when linkage.objectiveId is empty, fall back to MAESTRO_OBJECTIVE_ID / MAESTRO_EVALOPS_OBJECTIVE_ID via the existing getEnvValue helper so a set objective always reaches the wire; add a pre-flight guard that fails fast with a clear, unredacted error when the surface is platform-agent-runtime and no objectiveId is resolvable. The guard is scoped to the worker surface only. - maestro-event-bus.ts: read objective_id from both MAESTRO_OBJECTIVE_ID and MAESTRO_EVALOPS_OBJECTIVE_ID for consistency with auth.ts. - tests: cover linkage objectiveId on the wire, env fallback for both vars, and the worker-surface pre-flight guard (no fetch issued).
|
This PR changes mirrored Maestro source files in the public repo, but it does not link the matching private source-of-truth PR. Add one of these to the PR body, then re-run the check:
Mirrored files touched:
|
PR SummaryMedium Risk Overview Trusted worker env: Wire-up: Tool linkage and telemetry now resolve objective from linkage first, then Tests: Coverage for env fallbacks, linkage passthrough, worker-surface guard, and bridge linkage including Reviewed by Cursor Bugbot for commit 6bce0a8. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Mirrors the TS PLATFORM_TRUSTED_TOOL_ENV_ALLOWLIST addition (MAESTRO_OBJECTIVE_ID and MAESTRO_EVALOPS_OBJECTIVE_ID) so the Rust TUI runtime keeps the objective_id env vars for platform-worker subprocesses under restrictive shell-env policies. Addresses Devin review on PR #809.
Summary
Fixes Sentry PLATFORM-5 —
operating_chat_objective_id_required: worker error details redacted(culpritcodex_worker.operating_chat.operating_chat).Source-of-truth PR: https://github.com/evalops/maestro-internal/pull/2845
Root cause
The Platform "codex worker" operating-chat / tool-execution endpoint requires
objective_idon the request linkage for theplatform-agent-runtimesurface, but this client treatedobjective_idas optional end-to-end. Compounding it,MAESTRO_OBJECTIVE_IDwas not in the worker's trusted-tool env allowlist, so the objective context could be stripped before it ever reached the request linkage — producing the redacted server-side rejection.Fix
src/utils/shell-env.ts— addMAESTRO_OBJECTIVE_IDandMAESTRO_EVALOPS_OBJECTIVE_IDtoPLATFORM_TRUSTED_TOOL_ENV_ALLOWLISTso the objective survives into worker/trusted-tool subprocesses.src/platform/tool-execution-client.ts— resolveobjectiveIdfrom the linkage, falling back toMAESTRO_OBJECTIVE_ID/MAESTRO_EVALOPS_OBJECTIVE_ID, so a configured objective always reaches the wire. Added a pre-flight guard scoped to theplatform-agent-runtimesurface that fails fast with a clear, unredacted error whenobjective_idis still missing.src/telemetry/maestro-event-bus.ts— readobjective_idfrom both env var names for consistency withauth.ts.test/platform/tool-execution-client.test.ts— added coverage for linkage passthrough, env fallback (both vars), and the worker-surface guard.Validation
bun run bun:lint— pass (biome + codex/platform conformance validators).bunx vitest --run test/platform/tool-execution-client.test.ts test/platform/agent-runtime-client.test.ts— pass (28 tests).🔗 Slack thread: https://evalops.slack.com/archives/C0B8Y1J5U1H/p1782505086813659?thread_ts=1782505074.141379&cid=C0B8Y1J5U1H
Generated by Claude Code