Skip to content

Protect self-hosted run metadata environment before setup - #167

Merged
dmichelin merged 2 commits into
mainfrom
factory/run-agents-metadata-setup
Oct 12, 2026
Merged

dmichelin merged 2 commits into
mainfrom
factory/run-agents-metadata-setup

Conversation

@warp-agent-staging

@warp-agent-staging warp-agent-staging Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Protect server-injected run metadata before self-hosted setup and task execution. Reject known operator environment collisions instead of allowing backend merge order to overwrite a tag.

Part of REMOTE-3439, with protocol fields. Pair with server #19546 and runtime/client #16396. Deploy this worker before the metadata-producing server; no new assignment format is required.

Review guide

Check direct/Docker operator maps and Kubernetes task/container names. Explicit Kubernetes ValueFrom names are checked without loading secret values. Per requester approval, custom-image baked-in ENV and Kubernetes EnvFrom names are not inspected; operators must avoid the reserved WARP_METADATA_ namespace there.

What changed

  • Direct backend rejects operator/host collisions before setup and setup dotenv collisions before merging.
  • Docker and Kubernetes reject explicit configuration collisions before container APIs.
  • Kubernetes escapes every metadata $ for both setup and main container EnvVar.Value fields, preserving literal values without changing operator expansion.
  • Kubernetes marks only injected assignment metadata names readonly before sourcing setup dotenv output; unrelated multiline values cannot introduce protected names.
  • No-metadata tasks retain their existing merge behavior. The command backend remains unchanged because operator dispatch environment does not merge into its stdin task payload.

Validation

Passed go test ./internal/worker -count=1, go vet ./internal/worker, golangci-lint run ./internal/worker, and go build ./..., followed by scoped gofmt -w.

The direct-backend test executes a real setup shell that reads a tag and a present-empty value. Tests also reject direct setup-output, Docker operator, Kubernetes operator, and explicit secret-backed PodTemplate collisions before launch. The Kubernetes wrapper is exercised with a real POSIX shell. Manifest regressions cover references, double dollars, empty and multiline values in both container paths. Shell regressions cover unrelated multiline values and operator-only prefix variables, with and without injected metadata. Both regressions failed against the prior implementation in an isolated worktree and pass with this change. No live Docker/Kubernetes deployment was exercised.

Plans:

@cla-bot cla-bot Bot added the cla-signed label Oct 9, 2026
@warp-agent-staging

Copy link
Copy Markdown
Contributor Author

This PR was generated with Warp.

Comment @warp-staging-factory on this PR to send it follow-up work.

View run View conversation View on Slack

@warp-agent-staging
warp-agent-staging Bot requested a review from dmichelin October 9, 2026 23:48
@warp-agent-staging
warp-agent-staging Bot marked this pull request as ready for review October 9, 2026 23:48
dmichelin added a commit to warpdotdev/warp-proto-apis that referenced this pull request Oct 12, 2026
## Description
Add sensitive string metadata maps to `RunAgents` (batch defaults) and
`AgentRunConfig` (child overrides). Regenerate the checked-in Go
bindings; Rust and TypeScript remain build-generated.

## Justification
Part of
[REMOTE-3439](https://linear.app/warpdotdev/issue/REMOTE-3439/pass-run-agents-metadata-to-child-runs-and-expose-it-during-setup).
Orchestrators need to label children without changing parent
inheritance.

Requester context: “Yep, I think the idea is roughly to add metadata as
an option that you can set in the run_agents tool. That would then
populate the metadata field on the ai_task for the child run. Then in
the subagents execution, we'd resolve the metadata associated with that
run and flatten it to injected vars.”

Companions: [server
#19546](warpdotdev/warp-server#19546), [client
#16396](warpdotdev/warp#16396), and [worker
#167](warpdotdev/oz-agent-worker#167).

Optional/additive fields preserve old-client compatibility. Merge and
environment validation live in the client/server consumers, not the
protocol. Consumers pin commit
`6b33333f17ae74f1d18769672d6594d095b3f3da`; merge this dependency first.

Validation passed: `./script/generate -a multi_agent -v v1`, Go binding
tests, `npm ci`, `npm run generate:ts`, and `cargo build` (writable
temporary Cargo caches). Go generation used protoc 36.1 and
protoc-gen-go 1.36.6.

## Sensitive Fields
- [x] I have ensured that all string fields that contain sensitive
information are marked as `sensitive`.

<!-- warp:pr-description-artifacts start -->
_Plans_:
- _[Child-run metadata propagation and hosted setup
environment](https://staging.warp.dev/drive/notebook/cEWmXEXKmryDMxjyTa1tzH)_
<!-- warp:pr-description-artifacts end -->

Co-authored-by: warp-agent-staging[bot] <240773466+warp-agent-staging[bot]@users.noreply.github.com>
Co-authored-by: Daniel Michelin <[email protected]>
@dmichelin
dmichelin merged commit 63dbb8a into main Oct 12, 2026
8 checks passed
@dmichelin
dmichelin deleted the factory/run-agents-metadata-setup branch October 12, 2026 20:26
dmichelin pushed a commit to warpdotdev/warp that referenced this pull request Oct 12, 2026
## Description
Pass `run_agents` batch metadata and child overrides to child-run
creation. This lets orchestrators label each child while retaining
existing server-owned explicit > inherited > automatic precedence.

### Review guide
Start with protocol conversion, `RunAgentsExecutor` dispatch, and remote
request preparation. GUI and TUI confirmation reconstruction must
preserve both maps. TUI coverage dispatches the normal Accept action and
checks the controller’s captured request. Most other edits initialize
empty maps at existing constructors. The action variant boxes its
request so added metadata does not enlarge every action. MacOS Clippy
diagnosed a 320-byte request versus the next-largest 112-byte variant;
scoped Linux Clippy alone did not catch that target-dependent layout
gate.

Metadata persistence also travels through local child creation for
consistency; **embedded-local and standalone-local environment injection
remain out of scope**. Hosted/self-hosted metadata comes from the
server's environment transport before setup, not from new prompt
injection. The runtime rejects raw managed-secret names that collide
with injected metadata, including empty values.

Depends on [protocol PR
#398](warpdotdev/warp-proto-apis#398), pinned at
`6b33333f17ae74f1d18769672d6594d095b3f3da`. Pair with [worker PR
#167](warpdotdev/oz-agent-worker#167) and
[server PR
#19546](warpdotdev/warp-server#19546). Deploy
this runtime and worker conflict protection before metadata-producing
server rollout. Older clients continue to create children with inherited
metadata only.

The protocol pin also includes existing upstream web-fetch usage fields.
Two unrelated exhaustive test constructors gain defaults solely to
compile against that additive protocol version. The lockfile changes
only the protocol source revision.

Approved collision-check limits: custom-image baked-in ENV and
Kubernetes `EnvFrom` names are not inspected; operators must avoid
`WARP_METADATA_` there.

## Linked Issue

[REMOTE-3439](https://linear.app/warpdotdev/issue/REMOTE-3439/pass-run-agents-metadata-to-child-runs-and-expose-it-during-setup).
- [ ] The linked issue is labeled `ready-to-spec` or
`ready-to-implement`. This work uses an approved Linear contract, not a
GitHub issue with those labels.
- [ ] Where appropriate, screenshots or a short video of the
implementation are included below (especially for user-visible or UI
changes). No rendering change; validation is code and shell tests.

## Testing
Passed **266 tests** on the current candidate, covering metadata
conversion, independent child overrides, empty-value preservation,
remote wire payload, secret protection, and GUI/TUI orchestration
confirmation and dispatch.

Command: `cargo nextest run --locked -p ai -p warp -p warp_tui -E
'test(metadata) | test(secret_env_vars) | test(run_agents) |
test(orchestration_config) | test(orchestration_block) |
test(prepared_remote_request_matches_gui_wire_semantics)'
--no-fail-fast`.

Also passed `cargo clippy --locked -p ai -p warp -p warp_tui -p
warp_graphql --all-targets --tests -- -D warnings`, followed by
`./script/format`. Both commands used `CARGO_HOME=/home/agent/.cargo
CARGO_TARGET_DIR=/tmp/warp-metadata-target`.

The [MacOS enum-size
diagnostic](https://github.com/warpdotdev/warp/actions/runs/38006014105/job/114074927174)
is addressed by boxing the action payload, without suppressing the lint.
Normal push triggered [eligible cross-platform
CI](https://github.com/warpdotdev/warp/actions/runs/38006933433) on the
new head. Those results are pending, not green; green required checks
remain a merge gate.

An intermediate Clippy attempt exhausted disk; deleting only temporary
Cargo incremental caches recovered capacity and the retry passed. No
live hosted service launch or local Mac/Windows runner was exercised.
- [ ] I have manually tested my changes locally with `./script/run`. No
rendering change or computer-use verification scope.

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-OZ: Orchestrators can attach batch and per-child run metadata
for grouping and setup workflows.

<!-- warp:pr-description-artifacts start -->
_Plans_:
- _[Child-run metadata propagation and hosted setup
environment](https://staging.warp.dev/drive/notebook/cEWmXEXKmryDMxjyTa1tzH)_
- _[Fix run_agents action enum size CI
failure](https://staging.warp.dev/drive/notebook/BAAr5FHL6t28sL0Aa3Tkcv)_
<!-- warp:pr-description-artifacts end -->

---------

Co-authored-by: warp-agent-staging[bot] <240773466+warp-agent-staging[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant