Conversation
Closes #133 ## What changed ### Bug fix - `apply_workflow_file`: moved `find_agent_by_name` (HTTP) call to after the dry-run early-return so that `--dry-run` never contacts the orchestrator for workflow files. Previously, passing `--dry-run` on a single workflow YAML file still made an HTTP request to resolve the agent UUID. ### Enhanced output - `apply_agent_file` dry-run: shows resolved `working_dir`, `shell`, `worktree`, `model`, and `env` keys instead of just the agent name. - `apply_workflow_file` dry-run: shows `agent`, `source`, `poll_interval`, and `enabled` without any HTTP calls; uses the agent name symbolically. - `apply_directory` dry-run (JSON): emits full resolved config objects for every agent and workflow, not just the names. - `apply_directory` dry-run (text): updated summary line to note "no changes made". ### New tests (8 total) - `test_dry_run_agent_file_makes_no_http_calls` - `test_dry_run_agent_file_json_output` - `test_dry_run_workflow_file_makes_no_http_calls` - `test_dry_run_workflow_file_json_no_http_calls` - `test_dry_run_directory_makes_no_http_calls` - `test_dry_run_directory_json_contains_full_configs` - `test_dry_run_invalid_template_reports_error` - `test_dry_run_workflow_missing_prompt_fails_validation` Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #182 +/- ##
==========================================
+ Coverage 23.03% 26.34% +3.31%
==========================================
Files 50 50
Lines 4620 4722 +102
==========================================
+ Hits 1064 1244 +180
+ Misses 3556 3478 -78 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
geoffjay
left a comment
There was a problem hiding this comment.
Review: Changes Needed 🔴
The bug fix and enhanced output direction are both correct and the test strategy (using http://127.0.0.1:1 to prove no HTTP calls are made) is clever. However there is one compile error that must be fixed before this can merge, plus a few non-blocking suggestions.
🔴 Blocking: non-exhaustive match on SourceTemplate (compile error)
SourceTemplate has two variants — GithubIssues and GithubPullRequests — but the three new dry-run match arms only cover GithubIssues. Rust will reject this at compile time with:
error[E0004]: non-exhaustive patterns: `GithubPullRequests { .. }` not covered
Affected locations (all new code):
apply_workflow_file— JSON branch (match &tmpl.source { GithubIssues … })apply_workflow_file— human-readable branch (match &tmpl.source { GithubIssues … })apply_directory— JSON workflow builder (match &t.source { GithubIssues … })
The live code path (~line 400) already handles both variants correctly:
let source_config = match tmpl.source {
SourceTemplate::GithubIssues { .. } => TaskSourceConfig::GithubIssues { .. },
SourceTemplate::GithubPullRequests { .. } => TaskSourceConfig::GithubPullRequests { .. },
};Each new dry-run match needs a GithubPullRequests arm, e.g.:
let source_json = match &tmpl.source {
SourceTemplate::GithubIssues { owner, repo, labels, state } => serde_json::json!({
"type": "github_issues",
"owner": owner, "repo": repo, "labels": labels, "state": state,
}),
SourceTemplate::GithubPullRequests { owner, repo, labels, state } => serde_json::json!({
"type": "github_pull_requests",
"owner": owner, "repo": repo, "labels": labels, "state": state,
}),
};Apply the same fix to all three sites (JSON + human-readable in apply_workflow_file, and the workflow builder in apply_directory). A test covering a github_pull_requests source in dry-run mode should accompany the fix.
🟡 Non-blocking suggestions
1. Duplicated working_dir resolution
The same resolution block appears in apply_agent_file (dry-run), apply_agent (live), and apply_directory (dry-run JSON). Extracting to a helper keeps the logic in one place and ensures all three paths stay in sync if the resolution rules ever change:
fn resolve_working_dir(tmpl_working_dir: &str, yaml_path: &Path) -> String {
if tmpl_working_dir == "." {
std::env::current_dir()
.map(|p| p.to_string_lossy().to_string())
.unwrap_or_else(|_| ".".to_string())
} else {
let base = yaml_path.parent().unwrap_or(Path::new("."));
let full = base.join(tmpl_working_dir);
full.canonicalize().unwrap_or(full).to_string_lossy().to_string()
}
}2. Tests use fixed temp directory names — prefer tempfile::TempDir
Tests like agentd_dry_run_agent_test, agentd_dry_run_workflow_test, etc. use fixed names under the system temp dir. Parallel cargo test runs can collide or leave stale state if a test panics before remove_dir_all. The project already uses tempfile in storage.rs — TempDir::new() gives automatic cleanup and unique per-run names.
3. .gitignore change is out of scope
Adding ui/.vite/ is legitimate cleanup but unrelated to the dry-run fix. Ideally it belongs in a separate commit to keep this one focused.
4. resolve_prompt called twice in apply_directory dry-run
In Phase 0 (lines 475, 487), resolve_prompt is already called and validated. In the dry-run JSON builder (line 528) it's called again with unwrap_or_default(). Harmless, but caching the result in the workflow_templates vec (e.g. as (PathBuf, WorkflowTemplate, String)) avoids the redundant call and the silent unwrap_or_default.
Summary
Fixes a bug where
--dry-runon theapplycommand still made HTTP calls to the orchestrator when processing a single workflow file, and enhances the dry-run output to show full resolved configurations.Changes
Bug fix
apply_workflow_file: moved thefind_agent_by_nameHTTP call to after the dry-run early-return. Previously runningagent apply --dry-run .agentd/workflows/issue-worker.ymlstill contacted the orchestrator.Enhanced output
apply_agent_filedry-run: shows resolvedworking_dir,shell,worktree,model, and env keysapply_workflow_filedry-run: shows source details — no HTTP callsapply_directorydry-run (JSON): emits full resolved config objectsNew tests (8)
Each test uses
http://127.0.0.1:1— any HTTP call would immediately fail.Closes #133