Skip to content

feat: show workspace key and observer URL in agent-relay status#740

Merged
khaliqgant merged 2 commits into
mainfrom
relay-status
Apr 14, 2026
Merged

feat: show workspace key and observer URL in agent-relay status#740
khaliqgant merged 2 commits into
mainfrom
relay-status

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Apr 14, 2026

Summary

Focused replacement for #739 (which accumulated unrelated commits through merges). Rebased on latest main with only the status-command change.

  • Adds Workspace Key: and Observer: lines to agent-relay status output
  • Observer URL format: https://agentrelay.com/observer?key=<workspace_key>
  • Calls client.getSession() to fetch workspace_key from the broker

Example output

Status: RUNNING
Mode: broker (stdio)
PID: 52432
Project: /Users/khaliqgant/Projects/AgentWorkforce/relay
Agents: 0
Workspace Key: rk_live_0b4133c4853b0d266042401691f3dbf8
Observer: https://agentrelay.com/observer?key=rk_live_0b4133c4853b0d266042401691f3dbf8

Diff

Single file, +5 lines in src/cli/lib/broker-lifecycle.ts.

Test plan

  • agent-relay status against a running broker shows the two new lines
  • agent-relay status when getSession() has no workspace_key omits them gracefully

Replaces #739.


Open with Devin

- Add workspace_key from getSession() to status output
- Add full observer URL: https://agentrelay.com/observer?key=<workspace_key>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

The status test's SDK client mock was missing getSession, so the new
await client.getSession() call in runStatusCommand threw and skipped
past disconnect(). Add getSession to the mock, assert the new log
lines, and add an omission case for when workspace_key is empty.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Comment on lines +1302 to 1307
const session = await client.getSession();
if (session.workspace_key) {
deps.log(`Workspace Key: ${session.workspace_key}`);
deps.log(`Observer: https://agentrelay.com/observer?key=${session.workspace_key}`);
}
client.disconnect();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 client.disconnect() skipped when getSession() throws, leaking transport resources

The new client.getSession() call at line 1302 is placed before client.disconnect() at line 1307, both inside the try block. If getSession() throws (e.g., the broker doesn't support the endpoint, times out, or returns an error), execution jumps to the empty catch block and disconnect() is never called. This leaves the BrokerTransport un-cleaned (timers, open WebSocket if any). Before this PR, only getStatus() could throw before disconnect(), but the addition of getSession() introduces a new failure point after status info has already been successfully retrieved and logged — making the resource leak more likely in practice.

Suggested change
const session = await client.getSession();
if (session.workspace_key) {
deps.log(`Workspace Key: ${session.workspace_key}`);
deps.log(`Observer: https://agentrelay.com/observer?key=${session.workspace_key}`);
}
client.disconnect();
const session = await client.getSession();
if (session.workspace_key) {
deps.log(`Workspace Key: ${session.workspace_key}`);
deps.log(`Observer: https://agentrelay.com/observer?key=${session.workspace_key}`);
}
client.disconnect();
} catch {
// PID-based status is enough when broker query fails.
} finally {
client.disconnect();
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@khaliqgant khaliqgant merged commit 27309e9 into main Apr 14, 2026
43 checks passed
@khaliqgant khaliqgant deleted the relay-status branch April 14, 2026 10:30
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