-
Notifications
You must be signed in to change notification settings - Fork 60
fix(broker): workspace-scope auto node id so up injection works
#1216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3d9871a
6a0ff63
cc066f2
cfe8acc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| { | ||
| "id": "traj_lbmykojlyhtm", | ||
| "version": 1, | ||
| "task": { | ||
| "title": "Implement workspace-scoped node delivery fix" | ||
| }, | ||
| "status": "active", | ||
| "startedAt": "2026-06-30T15:37:17.052Z", | ||
| "agents": [ | ||
| { | ||
| "name": "default", | ||
| "role": "lead", | ||
| "joinedAt": "2026-06-30T15:39:47.866Z" | ||
| } | ||
| ], | ||
| "chapters": [ | ||
| { | ||
| "id": "chap_w24sy92u02nm", | ||
| "title": "Work", | ||
| "agentName": "default", | ||
| "startedAt": "2026-06-30T15:39:47.866Z", | ||
| "events": [ | ||
| { | ||
| "ts": 1782833987867, | ||
| "type": "decision", | ||
| "content": "Workspace-scope auto-derived node IDs only: Workspace-scope auto-derived node IDs only", | ||
| "raw": { | ||
| "question": "Workspace-scope auto-derived node IDs only", | ||
| "chosen": "Workspace-scope auto-derived node IDs only", | ||
| "alternatives": [], | ||
| "reasoning": "The pinned RELAY_NODE_TOKEN path must keep using the enrolled machine seed verbatim, while create_node auto-mint needs node IDs unique across workspaces for the same cwd." | ||
| }, | ||
| "significance": "high" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "commits": [], | ||
| "filesChanged": [], | ||
| "projectId": "AgentWorkforce/relay", | ||
| "tags": [], | ||
| "_trace": { | ||
| "startRef": "05d586b789623067f35a1fd2e9c0a4c1cdc1a96e", | ||
| "endRef": "05d586b789623067f35a1fd2e9c0a4c1cdc1a96e" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Trajectory: Probe Relay create_node HTTP status for local-up node conflict | ||
|
|
||
| > **Status:** ✅ Completed | ||
| > **Confidence:** 90% | ||
| > **Started:** June 30, 2026 at 08:35 AM | ||
| > **Completed:** June 30, 2026 at 08:37 AM | ||
|
|
||
| --- | ||
|
|
||
| ## Summary | ||
|
|
||
| Captured create_node probe: current restarted local-up workspace returned HTTP 500 internal_error with failed nodes insert for reused node_id; reported status/body to lead. | ||
|
|
||
| **Approach:** Standard approach |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "id": "traj_eowv9c937zq9", | ||
| "version": 1, | ||
| "task": { | ||
| "title": "Probe Relay create_node HTTP status for local-up node conflict" | ||
| }, | ||
| "status": "completed", | ||
| "startedAt": "2026-06-30T15:35:59.618Z", | ||
| "completedAt": "2026-06-30T15:37:06.842Z", | ||
| "agents": [], | ||
| "chapters": [], | ||
| "retrospective": { | ||
| "summary": "Captured create_node probe: current restarted local-up workspace returned HTTP 500 internal_error with failed nodes insert for reused node_id; reported status/body to lead.", | ||
| "approach": "Standard approach", | ||
| "confidence": 0.9 | ||
| }, | ||
| "commits": [], | ||
| "filesChanged": [], | ||
| "projectId": "AgentWorkforce/relay", | ||
| "tags": [], | ||
| "_trace": { | ||
| "startRef": "05d586b789623067f35a1fd2e9c0a4c1cdc1a96e", | ||
| "endRef": "05d586b789623067f35a1fd2e9c0a4c1cdc1a96e" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Trajectory: Investigate local up injection path | ||
|
|
||
| > **Status:** ✅ Completed | ||
| > **Confidence:** 90% | ||
| > **Started:** June 30, 2026 at 08:26 AM | ||
| > **Completed:** June 30, 2026 at 08:28 AM | ||
|
|
||
| --- | ||
|
|
||
| ## Summary | ||
|
|
||
| Investigated local-up runtime config and PTY broker logs. Found local-up bound to workspace 197732795721383936, home cloud/workspace config lacks explicit persisted coverage for that workspace, and parent broker logs show node_token_missing followed by node_not_found binding failures for claude and codex. | ||
|
|
||
| **Approach:** Standard approach | ||
|
|
||
| --- | ||
|
|
||
| ## Key Decisions | ||
|
|
||
| ### Treat parent relay-hyperagent log as authoritative for local-up injection failure | ||
|
|
||
| - **Chose:** Treat parent relay-hyperagent log as authoritative for local-up injection failure | ||
| - **Reasoning:** Child PTY logs were empty or only had readiness warnings, while the parent broker log records node token mint failure and node binding failures for claude and codex. | ||
|
|
||
| --- | ||
|
|
||
| ## Chapters | ||
|
|
||
| ### 1. Work | ||
|
|
||
| _Agent: default_ | ||
|
|
||
| - Treat parent relay-hyperagent log as authoritative for local-up injection failure: Treat parent relay-hyperagent log as authoritative for local-up injection failure |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| { | ||
| "id": "traj_wwmbn0x18dso", | ||
| "version": 1, | ||
| "task": { | ||
| "title": "Investigate local up injection path" | ||
| }, | ||
| "status": "completed", | ||
| "startedAt": "2026-06-30T15:26:27.723Z", | ||
| "completedAt": "2026-06-30T15:28:57.709Z", | ||
| "agents": [ | ||
| { | ||
| "name": "default", | ||
| "role": "lead", | ||
| "joinedAt": "2026-06-30T15:28:57.629Z" | ||
| } | ||
| ], | ||
| "chapters": [ | ||
| { | ||
| "id": "chap_iaz4nysvb3oe", | ||
| "title": "Work", | ||
| "agentName": "default", | ||
| "startedAt": "2026-06-30T15:28:57.629Z", | ||
| "endedAt": "2026-06-30T15:28:57.709Z", | ||
| "events": [ | ||
| { | ||
| "ts": 1782833337630, | ||
| "type": "decision", | ||
| "content": "Treat parent relay-hyperagent log as authoritative for local-up injection failure: Treat parent relay-hyperagent log as authoritative for local-up injection failure", | ||
| "raw": { | ||
| "question": "Treat parent relay-hyperagent log as authoritative for local-up injection failure", | ||
| "chosen": "Treat parent relay-hyperagent log as authoritative for local-up injection failure", | ||
| "alternatives": [], | ||
| "reasoning": "Child PTY logs were empty or only had readiness warnings, while the parent broker log records node token mint failure and node binding failures for claude and codex." | ||
| }, | ||
| "significance": "high" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "retrospective": { | ||
| "summary": "Investigated local-up runtime config and PTY broker logs. Found local-up bound to workspace 197732795721383936, home cloud/workspace config lacks explicit persisted coverage for that workspace, and parent broker logs show node_token_missing followed by node_not_found binding failures for claude and codex.", | ||
| "approach": "Standard approach", | ||
| "confidence": 0.9 | ||
| }, | ||
| "commits": [], | ||
| "filesChanged": [], | ||
| "projectId": "AgentWorkforce/relay", | ||
| "tags": [], | ||
| "_trace": { | ||
| "startRef": "05d586b789623067f35a1fd2e9c0a4c1cdc1a96e", | ||
| "endRef": "05d586b789623067f35a1fd2e9c0a4c1cdc1a96e" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ use uuid::Uuid; | |
| use crate::worker_request::{RequestWorkerError, DEFAULT_REQUEST_TIMEOUT}; | ||
|
|
||
| const LISTEN_API_SEND_TIMEOUT: Duration = Duration::from_secs(30); | ||
| const HEALTH_STATUS_TIMEOUT: Duration = Duration::from_millis(100); | ||
|
|
||
| type PtyInputSerializers = Arc<tokio::sync::Mutex<HashMap<String, Arc<tokio::sync::Mutex<()>>>>>; | ||
|
|
||
|
|
@@ -499,16 +500,72 @@ pub(crate) fn listen_api_health_payload( | |
| "wsConnections": 0, | ||
| "memoryMb": 0, | ||
| "relaycastConnected": startup_error_code.is_none(), | ||
| "nodeConnected": false, | ||
| "nodeDelivery": { | ||
| "tokenPresent": false, | ||
| "connected": false, | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| async fn listen_api_health( | ||
| axum::extract::State(state): axum::extract::State<ListenApiState>, | ||
| ) -> axum::Json<Value> { | ||
| axum::Json(listen_api_health_payload( | ||
| state.default_workspace_id, | ||
| state.memberships, | ||
| )) | ||
| let mut payload = listen_api_health_payload(state.default_workspace_id, state.memberships); | ||
| if let Some(status) = fetch_status_for_health(&state.tx).await { | ||
| merge_status_into_health_payload(&mut payload, &status); | ||
| } | ||
| axum::Json(payload) | ||
| } | ||
|
|
||
| async fn fetch_status_for_health(tx: &mpsc::Sender<ListenApiRequest>) -> Option<Value> { | ||
| let (reply_tx, reply_rx) = tokio::sync::oneshot::channel(); | ||
| tx.try_send(ListenApiRequest::GetStatus { reply: reply_tx }) | ||
| .ok()?; | ||
| timeout(HEALTH_STATUS_TIMEOUT, reply_rx) | ||
| .await | ||
| .ok()? | ||
| .ok()? | ||
| .ok() | ||
| } | ||
|
Comment on lines
+521
to
+530
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The async fn fetch_status_for_health(tx: &mpsc::Sender<ListenApiRequest>) -> Option<Value> {
let (reply_tx, reply_rx) = tokio::sync::oneshot::channel();
tx.try_send(ListenApiRequest::GetStatus { reply: reply_tx })
.ok()?;
timeout(HEALTH_STATUS_TIMEOUT, reply_rx)
.await
.ok()?
.ok()?
.ok()
} |
||
|
|
||
| fn merge_status_into_health_payload(payload: &mut Value, status: &Value) { | ||
| let Some(object) = payload.as_object_mut() else { | ||
| return; | ||
| }; | ||
| if let Some(agent_count) = status.get("agent_count").and_then(Value::as_u64) { | ||
| object.insert("agentCount".to_string(), json!(agent_count)); | ||
| } | ||
| if let Some(pending_count) = status.get("pending_delivery_count").and_then(Value::as_u64) { | ||
| object.insert("pendingDeliveryCount".to_string(), json!(pending_count)); | ||
| } | ||
| let token_present = status | ||
| .get("node_delivery") | ||
| .and_then(|value| value.get("token_present")) | ||
| .and_then(Value::as_bool) | ||
| .unwrap_or(false); | ||
| let connected = status | ||
| .get("node_connected") | ||
| .and_then(Value::as_bool) | ||
| .or_else(|| { | ||
| status | ||
| .get("node_delivery") | ||
| .and_then(|value| value.get("connected")) | ||
| .and_then(Value::as_bool) | ||
| }) | ||
| .unwrap_or(false); | ||
| object.insert("nodeConnected".to_string(), json!(connected)); | ||
| object.insert( | ||
| "nodeDelivery".to_string(), | ||
| json!({ | ||
| "tokenPresent": token_present, | ||
| "connected": connected, | ||
| }), | ||
| ); | ||
| object.insert( | ||
| "wsConnections".to_string(), | ||
| json!(if connected { 1 } else { 0 }), | ||
| ); | ||
| } | ||
|
|
||
| /// Authenticated endpoint that returns broker configuration, including the | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.