Skip to content

feat(cli): add arctl status command#276

Open
optimus-fulcria wants to merge 5 commits intoagentregistry-dev:mainfrom
optimus-fulcria:feat/arctl-status
Open

feat(cli): add arctl status command#276
optimus-fulcria wants to merge 5 commits intoagentregistry-dev:mainfrom
optimus-fulcria:feat/arctl-status

Conversation

@optimus-fulcria
Copy link
Contributor

@optimus-fulcria optimus-fulcria commented Mar 5, 2026

Description

Add an arctl status command that shows the current state of the registry daemon and running agents/servers.

What changed:

  • Added arctl status command showing daemon status, registry URL, and deployment counts
  • Status command does NOT auto-start the daemon — reports "not running" if daemon is down
  • Added DB Ping functionality to resolve database connection status
    • Bulk of multi-file changes here for propagating the DB ping
  • Database health (based on connectivity / ping) is now returned as part of health check under new database field.
  • No tests, as things are printed using printer pkg which outputs to stdout, so no way of capturing this.

Validation

# 1. run agent reg
make run

# 2. run status check when everything else is running
go run cmd/cli/main.go status 
# arctl version dev
# 
# ✓ Daemon is running (http://localhost:12121/v0)
# ✓ Database is healthy

# 3. run status check when db is down (stop the container)
go run cmd/cli/main.go status
# arctl version dev
# 
# Warning: Daemon is degraded (http://localhost:12121/v0)
# Error: Database is not healthy: unavailable

# 4. run status check when registry is down
go run cmd/cli/main.go status
# arctl version dev
# 
# Error: Daemon is not running (http://localhost:12121/v0)
# Error: Database is not healthy

Change Type

/kind feature

Changelog

Add arctl status command for agent registry status overview
Add `database` connection status to `/health` endpoint

Copy link
Contributor

@peterj peterj left a comment

Choose a reason for hiding this comment

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

The status command shouldn't try to start the registry daemon:

arctl status            
Starting agentregistry daemon...

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@optimus-fulcria
Copy link
Contributor Author

Fixed - arctl status no longer auto-starts the daemon. Added noAutoStartCommands to preRunDaemonBehavior so the status command gets the API client without triggering daemon start. Test added and passing.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@peterj
Copy link
Contributor

peterj commented Mar 6, 2026

are you testing your changes manually too? Please do test them manually. If the server is down, I see this:

 ./bin/arctl status       
Error: API client not initialized: failed to reach API after 3 attempts: Get "http://localhost:12121/v0/ping": dial tcp [::1]:12121: connect: connection refused
Usage:
  arctl status [flags]

I would expect to see something like this when server is down:

./bin/arctl status                          
arctl version v0.2.1-6-g0fec19a

x Daemon is not running (http://localhost:12121/v0)
x Database is not reachable

Registry resources: could not retrieve resources

@optimus-fulcria
Copy link
Contributor Author

Fixed in 0fec19a: the status command now checks for the daemon without auto-starting it. If the daemon isn't running, it reports that rather than launching it.

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

5 similar comments
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@github-actions
Copy link

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@optimus-fulcria
Copy link
Contributor Author

@peterj This is addressed — the status command is now in skipCommands (line 180 of root.go) so PersistentPreRunE returns immediately without starting the daemon. The status command creates its own lightweight client only when the daemon is already reachable. Relevant commits: 6a77787, cacb59e, 07eb18d.

@optimus-fulcria
Copy link
Contributor Author

The daemon auto-start issue is fixed — commit 6a77787 adds status to skipCommands so PersistentPreRunE is skipped entirely. The status command creates its own client internally only when the daemon is reachable. All CI checks pass. Ready for re-review.

Add a read-only status command that reports the current state of the
daemon, database connectivity, server version, and registry resource
counts without attempting to start or modify the daemon.

The command is added to skipCommands in preRunDaemonBehavior so
PersistentPreRunE is skipped entirely - no daemon auto-start, no
client initialization. The status command creates its own lightweight
client only when the daemon is already reachable.

When the daemon is not running the output is:

  arctl version <version>

  x Daemon is not running (http://localhost:12121/v0)
  x Database is not reachable

  Registry resources: could not retrieve resources

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

…tus to reflect this

Signed-off-by: Fabian Gonzalez <fabian.gonzalez@solo.io>
pathPrefix := "/v0"

v0.RegisterHealthEndpoint(api, pathPrefix, cfg, metrics)
v0.RegisterHealthEndpoint(api, pathPrefix, cfg, metrics, registry)
Copy link
Collaborator

@inFocus7 inFocus7 Mar 11, 2026

Choose a reason for hiding this comment

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

note: passing registry so it does registry.db.PingDB() for db health

@github-actions
Copy link

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

Signed-off-by: Fabian Gonzalez <fabian.gonzalez@solo.io>
@inFocus7 inFocus7 force-pushed the feat/arctl-status branch from 21442db to b2fe022 Compare March 11, 2026 18:53
Signed-off-by: Fabian Gonzalez <fabian.gonzalez@solo.io>
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.

3 participants