Skip to content

fix: CLI agent mode review — logging init, flag scoping, dead code#290

Open
santoshkumarradha wants to merge 1 commit intomainfrom
fix/cli-agent-mode-review
Open

fix: CLI agent mode review — logging init, flag scoping, dead code#290
santoshkumarradha wants to merge 1 commit intomainfrom
fix/cli-agent-mode-review

Conversation

@santoshkumarradha
Copy link
Member

Summary

Post-merge review fixes for PR #284 (CLI Agent Mode). These issues were found during code review but the PR was merged before the fix commit landed.

Issues Found & Fixed

Bug (High)

  • Empty PersistentPreRun on agent command silently overrode root PersistentPreRunElogger.InitLogger() was never called for any af agent * subcommand. Removed the empty override so cobra traverses to parent's hook.

Quality (Medium)

  • --output and --timeout as root PersistentFlags polluted af dev, af server, af run help text with irrelevant flags. Moved to agent command's local PersistentFlags.
  • Redundant server URL fallback in agentHTTP() — dead code since GetServerURL() already returns the default. Removed.
  • Python SDK split docstring — URL resolution code was inserted between two docstrings; the second was an orphaned string literal. Merged into one proper docstring with resolution code after it.

Low

  • Added doc comment to packages/server_url.go for parity with services/server_url.go.

Changed Files (4 files, +17/-23)

  • control-plane/internal/cli/agent_commands.go
  • control-plane/internal/cli/root.go
  • control-plane/internal/packages/server_url.go
  • sdk/python/agentfield/agent.py

Verification

  • go build ./...
  • go vet ./...
  • go test — 190 tests pass ✅

Relates to #281, #282

…, docstring

- Remove empty PersistentPreRun on agent command that silently
  overrode root PersistentPreRunE, preventing logger initialization
  for all af agent subcommands
- Move --output and --timeout flags from root PersistentFlags to
  agent command scope (avoid polluting af dev, af server, etc.)
- Remove redundant server URL fallback in agentHTTP() (GetServerURL
  already handles the default)
- Fix Python SDK split docstring: merge orphaned string literal back
  into __init__ docstring, place resolution code after docstring
- Add doc comment to packages/server_url.go for parity with
  services/server_url.go
@santoshkumarradha santoshkumarradha requested review from a team and AbirAbbas as code owners March 19, 2026 05:25
@github-actions
Copy link
Contributor

Performance

SDK Memory Δ Latency Δ Tests Status
Python 9.3 KB +4% 0.34 µs -3%

✓ No regressions detected

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.

1 participant