Enable runtime YAML export for copy workflows#15
Merged
Sodawyx merged 2 commits intoJun 9, 2026
Conversation
Add a read-only runtime export command that emits apply-compatible YAML for existing container runtimes and endpoints, plus docs and integration coverage. Keep the implementation bounded to fields already accepted by the runtime YAML parser. Constraint: Export output must round-trip through ar runtime apply without carrying server-owned IDs or status fields. Rejected: Reconstructing cloudBuild from remote runtime state | cloudBuild depends on local source and build settings that are not recoverable from the service. Confidence: high Scope-risk: narrow Directive: Treat exported registry auth as sensitive if returned by the service; review YAML before sharing. Tested: ruff check src/ tests/; ruff format --check src/ tests/; mypy src/agentrun_cli; pytest tests/integration/test_runtime_cmd.py -v; pytest tests/unit tests/integration --cov=agentrun_cli --cov-fail-under=95; live cn-hangzhou export/apply/status smoke for cli-export-verify-20260609213323. Change-Id: Ib7d4b629bbb2e377213b3aa302d7d78d13c7f066 Co-developed-by: Codex <noreply@openai.com> Not-tested: cleanup/delete of live verification runtime was intentionally not performed without explicit deletion confirmation. Signed-off-by: congxiao.wxx <congxiao.wxx@alibaba-inc.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new ar runtime export command to export an existing Agent Runtime into apply-ready YAML, and updates docs/tests accordingly.
Changes:
- Introduced
runtime exportCLI subcommand and YAML conversion helper (runtime_to_yaml_doc). - Added integration tests covering stdout export, file output, and error cases.
- Documented the new command in English and Chinese runtime docs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/test_runtime_cmd.py | Adds integration tests validating runtime export output and edge cases. |
| src/agentrun_cli/commands/runtime/export_cmd.py | Implements ar runtime export and runtime-to-YAML conversion helpers. |
| src/agentrun_cli/commands/runtime/init.py | Registers the new export command in the runtime command group. |
| src/agentrun_cli/_utils/cloud_build.py | Minor normalization of sys.platform handling in _go_platform(). |
| docs/zh/runtime.md | Documents the new export command (Chinese). |
| docs/en/runtime.md | Documents the new export command (English). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+184
to
+188
| auth = _get(registry, "auth_config", "authConfig", "auth") | ||
| auth_out: dict[str, Any] = {} | ||
| _set_if_present(auth_out, "userName", _get(auth, "user_name", "userName")) | ||
| _set_if_present(auth_out, "password", _get(auth, "password")) | ||
| _set_if_present(out, "auth", auth_out) |
Comment on lines
+147
to
+148
| if hasattr(runtime, "list_endpoints"): | ||
| spec["endpoints"] = [_export_endpoint(ep) for ep in runtime.list_endpoints()] |
| ) | ||
| assert result.exit_code == 0, result.output | ||
| assert result.output == "" | ||
| out = yaml.safe_load(open("runtime.yaml", encoding="utf-8")) |
Default export output now omits registry passwords unless the caller explicitly passes --include-secrets. Empty endpoint lists are omitted so apply keeps its default endpoint behavior, and the file-output test closes handles explicitly. Constraint: Review feedback identified secret leakage and empty-endpoint semantic drift risks. Rejected: Always exporting passwords with only documentation warnings | stdout/file exports can leak secrets by default. Confidence: high Scope-risk: narrow Directive: Keep sensitive fields opt-in for future export surfaces. Tested: ruff check src/ tests/; ruff format --check src/ tests/; mypy src/agentrun_cli; pytest tests/integration/test_runtime_cmd.py -v; pytest tests/unit tests/integration --cov=agentrun_cli --cov-fail-under=95 Signed-off-by: congxiao.wxx <congxiao.wxx@alibaba-inc.com> Change-Id: I3fb430af1fc41cf581911a5b84a1dd1c0941760b Co-developed-by: Codex <noreply@openai.com>
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.
Add a read-only runtime export command that emits apply-compatible YAML for existing container runtimes and endpoints, plus docs and integration coverage. Keep the implementation bounded to fields already accepted by the runtime YAML parser.
Constraint: Export output must round-trip through ar runtime apply without carrying server-owned IDs or status fields.
Rejected: Reconstructing cloudBuild from remote runtime state | cloudBuild depends on local source and build settings that are not recoverable from the service.
Confidence: high
Scope-risk: narrow
Directive: Treat exported registry auth as sensitive if returned by the service; review YAML before sharing.
Tested: ruff check src/ tests/; ruff format --check src/ tests/; mypy src/agentrun_cli; pytest tests/integration/test_runtime_cmd.py -v; pytest tests/unit tests/integration --cov=agentrun_cli --cov-fail-under=95; live cn-hangzhou export/apply/status smoke for cli-export-verify-20260609213323.
Change-Id: Ib7d4b629bbb2e377213b3aa302d7d78d13c7f066
Co-developed-by: Codex noreply@openai.com
Not-tested: cleanup/delete of live verification runtime was intentionally not performed without explicit deletion confirmation.