Imported from GitHub samson-media/barn#24 — opened by @daniel-samson on 2026-01-21 20:56:08 UTC
Bug Description
CLI commands like barn status, barn run, barn describe, etc. have runWithService() methods that are stubs - they just display an error message instead of actually communicating with the running service via IPC.
Expected Behavior
When the service is running, CLI commands should use IpcClient to send requests to the service via the Unix domain socket at /tmp/barn/barn.sock.
Actual Behavior
All runWithService() methods return:
Service not running. Start with: barn service start
Or use --offline to run without the service.
Even when the service IS running and the socket exists.
Affected Commands
StatusCommand.runWithService()
RunCommand.runWithService()
DescribeCommand.runWithService()
KillCommand.runWithService()
CleanCommand.runWithService()
UsageCommand.runWithService()
Root Cause
The IPC infrastructure (IpcClient, IpcServer, IpcMessage) exists but the CLI commands haven't been wired up to use it.
Fix
Each command's runWithService() method needs to:
Create an IpcClient with the default socket path
Send the appropriate IPC request
Handle the response and display output
<!-- github-import:issue:24 -->
_Imported from GitHub samson-media/barn#24 — opened by **@daniel-samson** on 2026-01-21 20:56:08 UTC_
## Bug Description
CLI commands like `barn status`, `barn run`, `barn describe`, etc. have `runWithService()` methods that are stubs - they just display an error message instead of actually communicating with the running service via IPC.
## Expected Behavior
When the service is running, CLI commands should use `IpcClient` to send requests to the service via the Unix domain socket at `/tmp/barn/barn.sock`.
## Actual Behavior
All `runWithService()` methods return:
```
Service not running. Start with: barn service start
Or use --offline to run without the service.
```
Even when the service IS running and the socket exists.
## Affected Commands
- `StatusCommand.runWithService()`
- `RunCommand.runWithService()`
- `DescribeCommand.runWithService()`
- `KillCommand.runWithService()`
- `CleanCommand.runWithService()`
- `UsageCommand.runWithService()`
## Root Cause
The IPC infrastructure (`IpcClient`, `IpcServer`, `IpcMessage`) exists but the CLI commands haven't been wired up to use it.
## Fix
Each command's `runWithService()` method needs to:
1. Create an `IpcClient` with the default socket path
2. Send the appropriate IPC request
3. Handle the response and display output
daniel
added the bug label 2026-10-04 19:28:30 +00:00
<!-- github-import:comment:3781167406 -->
_**@daniel-samson** commented on 2026-01-21 21:07:18 UTC:_
Fixed CLI commands to use IPC when communicating with the running service.
**Changes:**
1. **BarnService.java** - Added IPC request handlers:
- `get_status` - List jobs with optional filters
- `get_job` - Get job details by ID
- `run_job` - Create and queue a new job
- `kill_job` - Stop a running job
- `clean_jobs` - Remove completed jobs
2. **CLI Commands Updated:**
- `StatusCommand` - Uses IpcClient to fetch job list from service
- `RunCommand` - Uses IpcClient to submit jobs to service
- `DescribeCommand` - Uses IpcClient to get job details
- `KillCommand` - Uses IpcClient to kill jobs via service
- `CleanCommand` - Uses IpcClient to clean jobs via service
- `UsageCommand` - Uses IpcClient to verify job exists, reads usage.csv directly
All 901 tests pass.
@daniel-samson commented on 2026-01-21 21:34:21 UTC:
Additional fix applied to resolve remaining issues:
Root Cause:
The CLI commands were using System.getProperty("java.io.tmpdir") for the barn directory on macOS, which returns /var/folders/.../barn. However, the service uses ConfigDefaults.getDefaultBaseDir() which returns /tmp/barn. This directory mismatch meant the CLI commands were looking for jobs in a different directory than where the service was managing them.
Changes:
Updated all CLI commands to use ConfigDefaults.getDefaultBaseDir() consistently
Updated CLI commands to use the socket path from their configured barn directory (via getBarnDirectories().getSocketPath()) instead of a static default
Added getSocketPath() method to BarnDirectories class
Added --barn-dir CLI option to StatusCommand and CleanCommand (hidden, for testing)
Fixed Jackson deserialization issue by configuring ObjectMapper to ignore unknown properties (Job record's boolean accessor methods like isRunning() were being serialized as extra fields)
Testing:
All 901 tests pass
Manual testing confirms barn status and barn service status now show the same job data
<!-- github-import:comment:3781267782 -->
_**@daniel-samson** commented on 2026-01-21 21:34:21 UTC:_
Additional fix applied to resolve remaining issues:
**Root Cause:**
The CLI commands were using `System.getProperty("java.io.tmpdir")` for the barn directory on macOS, which returns `/var/folders/.../barn`. However, the service uses `ConfigDefaults.getDefaultBaseDir()` which returns `/tmp/barn`. This directory mismatch meant the CLI commands were looking for jobs in a different directory than where the service was managing them.
**Changes:**
1. Updated all CLI commands to use `ConfigDefaults.getDefaultBaseDir()` consistently
2. Updated CLI commands to use the socket path from their configured barn directory (via `getBarnDirectories().getSocketPath()`) instead of a static default
3. Added `getSocketPath()` method to `BarnDirectories` class
4. Added `--barn-dir` CLI option to StatusCommand and CleanCommand (hidden, for testing)
5. Fixed Jackson deserialization issue by configuring ObjectMapper to ignore unknown properties (Job record's boolean accessor methods like `isRunning()` were being serialized as extra fields)
**Testing:**
- All 901 tests pass
- Manual testing confirms `barn status` and `barn service status` now show the same job data
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Imported from GitHub samson-media/barn#24 — opened by @daniel-samson on 2026-01-21 20:56:08 UTC
Bug Description
CLI commands like
barn status,barn run,barn describe, etc. haverunWithService()methods that are stubs - they just display an error message instead of actually communicating with the running service via IPC.Expected Behavior
When the service is running, CLI commands should use
IpcClientto send requests to the service via the Unix domain socket at/tmp/barn/barn.sock.Actual Behavior
All
runWithService()methods return:Even when the service IS running and the socket exists.
Affected Commands
StatusCommand.runWithService()RunCommand.runWithService()DescribeCommand.runWithService()KillCommand.runWithService()CleanCommand.runWithService()UsageCommand.runWithService()Root Cause
The IPC infrastructure (
IpcClient,IpcServer,IpcMessage) exists but the CLI commands haven't been wired up to use it.Fix
Each command's
runWithService()method needs to:IpcClientwith the default socket path@daniel-samson commented on 2026-01-21 21:07:18 UTC:
Fixed CLI commands to use IPC when communicating with the running service.
Changes:
BarnService.java - Added IPC request handlers:
get_status- List jobs with optional filtersget_job- Get job details by IDrun_job- Create and queue a new jobkill_job- Stop a running jobclean_jobs- Remove completed jobsCLI Commands Updated:
StatusCommand- Uses IpcClient to fetch job list from serviceRunCommand- Uses IpcClient to submit jobs to serviceDescribeCommand- Uses IpcClient to get job detailsKillCommand- Uses IpcClient to kill jobs via serviceCleanCommand- Uses IpcClient to clean jobs via serviceUsageCommand- Uses IpcClient to verify job exists, reads usage.csv directlyAll 901 tests pass.
@daniel-samson commented on 2026-01-21 21:34:21 UTC:
Additional fix applied to resolve remaining issues:
Root Cause:
The CLI commands were using
System.getProperty("java.io.tmpdir")for the barn directory on macOS, which returns/var/folders/.../barn. However, the service usesConfigDefaults.getDefaultBaseDir()which returns/tmp/barn. This directory mismatch meant the CLI commands were looking for jobs in a different directory than where the service was managing them.Changes:
ConfigDefaults.getDefaultBaseDir()consistentlygetBarnDirectories().getSocketPath()) instead of a static defaultgetSocketPath()method toBarnDirectoriesclass--barn-dirCLI option to StatusCommand and CleanCommand (hidden, for testing)isRunning()were being serialized as extra fields)Testing:
barn statusandbarn service statusnow show the same job data