Skip to content

[maestro] Ensure objective_id is set for codex worker operating-chat requests - #809

Merged
haasonsaas merged 8 commits into
mainfrom
claude/slack-session-yi2k3y
Jun 26, 2026
Merged

[maestro] Ensure objective_id is set for codex worker operating-chat requests#809
haasonsaas merged 8 commits into
mainfrom
claude/slack-session-yi2k3y

Conversation

@haasonsaas

@haasonsaas haasonsaas commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes Sentry PLATFORM-5operating_chat_objective_id_required: worker error details redacted (culprit codex_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_id on the request linkage for the platform-agent-runtime surface, but this client treated objective_id as optional end-to-end. Compounding it, MAESTRO_OBJECTIVE_ID was 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 — add MAESTRO_OBJECTIVE_ID and MAESTRO_EVALOPS_OBJECTIVE_ID to PLATFORM_TRUSTED_TOOL_ENV_ALLOWLIST so the objective survives into worker/trusted-tool subprocesses.
  • src/platform/tool-execution-client.ts — resolve objectiveId from the linkage, falling back to MAESTRO_OBJECTIVE_ID / MAESTRO_EVALOPS_OBJECTIVE_ID, so a configured objective always reaches the wire. Added a pre-flight guard scoped to the platform-agent-runtime surface that fails fast with a clear, unredacted error when objective_id is still missing.
  • src/telemetry/maestro-event-bus.ts — read objective_id from both env var names for consistency with auth.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

…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).
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

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:

  • https://github.com/evalops/maestro-internal/pull/<number>
  • evalops/maestro-internal#<number>
  • maestro-internal#<number>

Mirrored files touched:

  • packages/tui-rs/src/tools/shell_env.rs
  • src/platform/tool-execution-client.ts
  • src/telemetry/maestro-event-bus.ts
  • src/utils/shell-env.ts
  • test/platform/tool-execution-client.test.ts

@cursor

cursor Bot commented Jun 26, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes tool-execution linkage and worker env allowlists on a critical Platform integration path; misconfiguration now fails fast instead of opaque server errors.

Overview
Fixes PLATFORM-5 by ensuring objective_id reaches Platform tool-execution requests for the codex worker (platform-agent-runtime) surface instead of being dropped or omitted.

Trusted worker env: MAESTRO_OBJECTIVE_ID and MAESTRO_EVALOPS_OBJECTIVE_ID are added to the platform trusted-tool allowlist in Node (shell-env.ts) and Rust (tui-rs shell_env.rs) so filtered shell subprocesses still see objective context.

Wire-up: Tool linkage and telemetry now resolve objective from linkage first, then MAESTRO_OBJECTIVE_ID / MAESTRO_EVALOPS_OBJECTIVE_ID (bridge, event bus). executeToolWithPlatform applies the same resolution when normalizing requests and fails fast with a clear error if the worker surface has no objective—before any HTTP call.

Tests: Coverage for env fallbacks, linkage passthrough, worker-surface guard, and bridge linkage including MAESTRO_EVALOPS_OBJECTIVE_ID.

Reviewed by Cursor Bugbot for commit 6bce0a8. Bugbot is set up for automated code reviews on this repo. Configure here.

@haasonsaas
haasonsaas marked this pull request as ready for review June 26, 2026 21:12
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

devin-ai-integration[bot]

This comment was marked as resolved.

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.
devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 0 new potential issues.

Open in Devin Review

@haasonsaas
haasonsaas enabled auto-merge (squash) June 26, 2026 22:26

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

Open in Devin Review

Comment thread src/platform/tool-execution-client.ts
Comment thread src/platform/tool-execution-client.ts
@haasonsaas
haasonsaas merged commit ba79e83 into main Jun 26, 2026
15 checks passed
@haasonsaas
haasonsaas deleted the claude/slack-session-yi2k3y branch June 26, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants