Skip to content

CLI: expose named-agent prompt in oz agent create/update (REMOTE-2309) - #14261

Merged
jasonkeung merged 2 commits into
masterfrom
factory/oz-cli-named-agent-prompt
Jul 26, 2026
Merged

CLI: expose named-agent prompt in oz agent create/update (REMOTE-2309)#14261
jasonkeung merged 2 commits into
masterfrom
factory/oz-cli-named-agent-prompt

Conversation

@warp-agent-staging

Copy link
Copy Markdown
Contributor

Summary

The public REST API already supports an optional named-agent prompt in CreateAgentRequest/UpdateAgentRequest/AgentResponse (warp-server/public_api/openapi.yaml), and the Oz web app uses it, but the Oz CLI never exposed it. This adds CLI parity with no server change — an additive, localized analogue of the existing description/base_model/environment remove-flag patterns.

Behavior added:

  • oz agent create --name <NAME> --prompt <TEXT> sets the base prompt (CreateAgentRequest.prompt).
  • oz agent update <UID> --prompt <TEXT> replaces the prompt (UpdateAgentRequest.prompt).
  • oz agent update <UID> --remove-prompt clears the prompt via the REST API's PATCH clear-via-empty semantics (Some(String::new())).
  • --prompt and --remove-prompt conflict on update (clap conflicts_with).
  • Omitting both update flags leaves the existing prompt unchanged (None).
  • A bare oz agent update <UID> with no changes still errors "No updates requested" (request_is_empty now includes prompt).
  • oz agent get/list surface the prompt (ndjson/json via serde; pretty/text via a new "Prompt" column).

Changes:

  • crates/warp_cli/src/agent.rs--prompt on AgentCreateArgs; --prompt/--remove-prompt (mutually exclusive) on AgentUpdateArgs.
  • app/src/server/server_api/ai.rsprompt: Option<String> on CreateAgentRequest/UpdateAgentRequest (skip_serializing_if = "Option::is_none") and AgentResponse (#[serde(default)]).
  • app/src/ai/agent_sdk/agent_management.rs — extracted build_create_request/build_update_request (testable, no live server) forwarding prompt with the replace/remove/unchanged mapping; request_is_empty includes prompt; "Prompt" table column.

Verification

  • warp_cli crate: cargo test -p warp_cli --lib213 passed, 0 failed. New tests: agent_update_rejects_prompt_and_remove_prompt (clap conflict), agent_update_accepts_prompt_replacement, agent_update_accepts_remove_prompt, agent_update_leaves_prompt_unset_when_neither_flag_passed, agent_create_accepts_prompt. cargo build -p warp_cli succeeds. cargo fmt --check passes.
  • app crate regression tests added in agent_management_tests.rs: build_create_request_forwards_prompt, build_update_request_replaces_prompt, build_update_request_remove_prompt_clears_via_empty_string, build_update_request_leaves_prompt_unchanged_when_neither_flag_set, request_is_empty_treats_prompt_as_an_update, request_is_empty_clears_prompt_still_counts_as_an_update, create/update serde omit/serialize/clear semantics, and AgentResponse prompt deserialization (present/absent/null).

Sandbox limitation (please note)

The warp (app) crate could not be compiled or tested in this cloud sandbox: the environment has 3.8 GiB RAM / no swap, and cargo check/cargo test -p warp --lib is OOM-killed (SIGKILL) even at -j 1 with debuginfo off. The full ./script/presubmit (workspace clippy + nextest) likewise cannot run here. The warp_cli layer (the user-facing CLI surface and clap arg-parsing) is fully built and tested locally; the app-crate changes are simple additive Option<String> field additions that follow the exact serde/forwarding pattern of the neighboring description/base_model/environment_id fields, and the new app-crate regression tests are written and will compile/run in CI (which has adequate memory). Please rely on CI for the app-crate build + test confirmation.

This is a headless CLI change (no UI), so no computer_use/screenshot verification applies.

Originating thread: https://warpdotdev.slack.com/archives/C0BDQDW8V5E/p1784913085618339

The public REST API already supports an optional named-agent `prompt` in
CreateAgentRequest/UpdateAgentRequest/AgentResponse, and the Oz web app uses
it, but the Oz CLI never exposed it. This adds CLI parity with no server
change.

crates/warp_cli/src/agent.rs:
- AgentCreateArgs: add `--prompt <TEXT>`.
- AgentUpdateArgs: add `--prompt <TEXT>` and `--remove-prompt`, mutually
  exclusive via clap `conflicts_with` (mirrors `--description`/
  `--remove-description`, `--base-model`/`--remove-base-model`,
  `--environment`/`--remove-environment`).

app/src/server/server_api/ai.rs:
- CreateAgentRequest/UpdateAgentRequest: add `prompt: Option<String>` with
  `skip_serializing_if = "Option::is_none"` (None = omit/unchanged;
  Some("") = clear via the API's PATCH clear-via-empty semantics).
- AgentResponse: add `prompt: Option<String>` with `#[serde(default)]` so
  `oz agent get`/`list` surface the server-returned prompt.

app/src/ai/agent_sdk/agent_management.rs:
- Extract `build_create_request`/`build_update_request` from the inline
  `create`/`update` bodies so the field forwarding is unit-testable without
  a live server; forward `prompt` (create) and the replace/remove/unchanged
  mapping (update) matching the existing scalar-field pattern.
- `request_is_empty` now treats `prompt` as an update, so a bare
  `oz agent update <UID>` still errors with "No updates requested".
- Add a "Prompt" column to the pretty/text agent table output.

Tests:
- crates/warp_cli/src/lib_tests.rs: clap conflict + accept-prompt/
  accept-remove-prompt/leave-unset/create-accepts-prompt parsing tests.
- app/src/ai/agent_sdk/agent_management_tests.rs: build_*_request prompt
  forwarding, request_is_empty, serde omit/serialize/clear semantics, and
  AgentResponse prompt deserialization (present/absent/null).

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jul 24, 2026
@warp-agent-staging
warp-agent-staging Bot marked this pull request as ready for review July 24, 2026 18:43
@oz-for-oss

oz-for-oss Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@warp-dev-github-integration[bot]

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-agent-staging
warp-agent-staging Bot requested a review from jasonkeung July 24, 2026 18:44

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overview

This PR adds named-agent prompt support to oz agent create/update, forwards the field through the typed public API request/response models, and surfaces prompts in CLI agent output.

Concerns

  • ⚠️ [IMPORTANT] This is a user-facing CLI behavior/output change, but the provided PR description does not include screenshots or a screen recording demonstrating the new create/update/get/list behavior end to end. Repository review policy requires visual evidence for user-facing changes; a short terminal recording or screenshots of the CLI output would satisfy this.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-agent-staging warp-agent-staging Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Overview

This PR adds the named-agent prompt field across the Oz CLI create/update arguments, local API request/response models, request forwarding, and tabular/serialized output. The create, replace, clear, unchanged, and clap-conflict behaviors match the ticket and existing remove-field patterns; all applicable GitHub CI checks are successful, and the focused warp_cli test/build gate passes locally (213 tests).

Verdict

Found: 0 critical, 0 important, 0 suggestions

Prior concerns: the earlier generic visual-evidence request does not apply because this is a headless CLI change, not a GUI/TUI surface.

Approve

Review run

https://oz.staging.warp.dev/runs/019f9574-e531-789c-8ca3-e7092fa421c1

Co-Authored-By: Oz <oz-agent@warp.dev>
@jasonkeung
jasonkeung merged commit 30aa7e9 into master Jul 26, 2026
26 checks passed
@jasonkeung
jasonkeung deleted the factory/oz-cli-named-agent-prompt branch July 26, 2026 18:36
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.

2 participants