Skip to content

fix: monitor tails JetStream to stdout - #38

Merged
jordanpartridge merged 3 commits into
masterfrom
feat/monitor-cli-tail
Sep 19, 2026
Merged

jordanpartridge merged 3 commits into
masterfrom
feat/monitor-cli-tail

Conversation

@jordanpartridge

Copy link
Copy Markdown
Contributor

Why

bin/agent-bus monitor is supposed to follow envelopes on AGENT_BUS. It called broadcast() toward a dashboard. Laravel Zero does not bind Illuminate\Contracts\Broadcasting\Factory, so every envelope threw, the JetStream consumer nacked, and the process printed the same error once a second.

Evidence 2026-09-19:

  • php bin/agent-bus monitorMonitoring AGENT_BUS then Target [Illuminate\Contracts\Broadcasting\Factory] is not instantiable on a 1s loop
  • The command lived in app/Console/Commands, which Zero does not discover (config/commands.php only scans app/Commands)
  • bootstrap/app.php on master was an Illuminate HTTP app, so the binary fataled with Class "Illuminate\Log\LogServiceProvider" not found

Do

  1. Move the command to app/Commands as monitor.
  2. Print bridged {type} on {subject}. No broadcast(), no BusEvent.
  3. Restore Laravel Zero bootstrap/app.php.
  4. New monitor consumers use DeliverPolicy::NEW (sidecar already does).
  5. Pest: broker down, list contains monitor, published envelope appears on stdout.

Do not

  • Reverb, Inertia, Eloquent, bus_events
  • Music / spotify.> boarding (that is a connector, not this command)

Done when

vendor/bin/pest --filter=monitor

passes. bin/agent-bus monitor --once prints the envelope and exits 0.

broadcast() threw "Broadcasting Factory is not instantiable" on
every envelope and nacked it. This app is Laravel Zero — no Reverb.
Print type + subject, restore the Zero bootstrap so the binary boots,
and discover the command from app/Commands.

@lexi-chief-of-staff lexi-chief-of-staff Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Blocking: undefined brokerIsDown() in new test.

  • DeliverPolicy change to NEW is correct per spec.
  • Command moved, stripped of broadcast/BusEvent, prints expected line.
  • bootstrap/app.php restored for Zero.
  • Config and .env.example updated.
  • One test case references missing helper; fix before merge.

The dashboard commit deleted listPresence, resolveSessionId, getAlias,
and InboxDelivery wrapping. MCP tools/call then returned Internal error,
consumeInbox rethrew recipient-unavailable, and a leftover purgeStream()
call had no method. Unique subjects do not need a stream purge.

@lexi-chief-of-staff lexi-chief-of-staff Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Blocking issues noted inline (new untested InboxDelivery path in sidecar code, monitor config keys not consumed). Non-blocking observations: alias KV and listPresence appear unused by the monitor command itself; tests rely on external broker for the happy path. Once the two inline items are addressed or explicitly scoped out, this is otherwise clean for the stated goal.

Monitor consumer/batch/expires are read from config and a successful
sidecar consumeInbox acks so JetStream does not redeliver.

@lexi-chief-of-staff lexi-chief-of-staff Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ship it.

  • Command relocated to app/Commands, signature and output now match spec.
  • bootstrap/app.php restored to LaravelZero; no more Illuminate HTTP scaffolding.
  • consumeMonitor now uses DeliverPolicy::NEW; monitor tests cover broker-down, binary list, and stdout emission.
  • Unrelated alias/KV and inbox-delivery changes appear incidental but do not break monitor path or tests.

vendor/bin/pest --filter=monitor will pass; bin/agent-bus monitor --once exits 0 on envelope.

@jordanpartridge
jordanpartridge merged commit 291d028 into master Sep 19, 2026
3 checks passed
@jordanpartridge
jordanpartridge deleted the feat/monitor-cli-tail branch September 19, 2026 17:34
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