Skip to content

feat: add workflow for relay bootstrap and messaging fixes#708

Merged
khaliqgant merged 19 commits intomainfrom
miya/relay-fix-workflow
Apr 11, 2026
Merged

feat: add workflow for relay bootstrap and messaging fixes#708
khaliqgant merged 19 commits intomainfrom
miya/relay-fix-workflow

Conversation

@miyaontherelay
Copy link
Copy Markdown
Contributor

@miyaontherelay miyaontherelay commented Apr 10, 2026

Summary

  • add a workflow that captures, fixes, and verifies local agent-relay bootstrap and messaging issues
  • split installer/bootstrap fixes and local messaging fixes into parallel implementation tracks
  • include deterministic rebuild and integration verification in the sage repo

Why

We surfaced several concrete issues while testing local headless orchestration:

  • broken launcher/shim resolution for agent-relay
  • installer/bootstrap gaps
  • local messaging quirks (send sender identity and history requiring RELAY_API_KEY)

This workflow gives the team a structured way to fix and verify those issues end-to-end.


Open with Devin

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 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Comment thread workflows/relay-fix-workflow.ts Outdated
type: 'deterministic',
dependsOn: ['smoke-test-local-launcher'],
command: `
set -e
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot Apr 10, 2026

Choose a reason for hiding this comment

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

🟡 set -e causes orphaned broker process when integration test commands fail

In the integration-test-sage step, set -e (line 164) causes the shell to exit immediately on the first failing command. A broker process is backgrounded on line 167 (agent-relay up ... &), but if any of the subsequent commands (status, spawn, who, send, etc. on lines 170-176) fail, the cleanup commands on lines 177-179 (release, down, wait $BROKER_PID) are never reached, leaving the broker process orphaned. A trap should be added to ensure cleanup runs on exit.

Suggested fix pattern

Replace set -e with a trap that ensures cleanup:

cleanup() {
  env PATH="$HOME/.local/bin:$PATH" agent-relay release WorkflowProbe || true
  env PATH="$HOME/.local/bin:$PATH" agent-relay down --force --timeout 5000 || true
  [ -n "$BROKER_PID" ] && wait $BROKER_PID || true
}
trap cleanup EXIT
Open in Devin Review

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Resolved — the workflows/relay-fix-workflow.ts file was removed from the repo in commit d283ddd. The orphaned broker concern no longer applies.

@khaliqgant
Copy link
Copy Markdown
Member

Ran the workflow locally against a clean PR checkout and fixed the workflow so it can actually execute from a clean state:\n\n- uses a deterministic plan doc instead of depending on a flaky Claude planning step\n- builds before so clean-checkout validation no longer fails\n- reran and validated the corrected build sequence locally (

@agent-relay/config@4.0.9 build
tsc,
agent-relay@4.0.9 build:sdk
cd packages/sdk && npm run build

@agent-relay/sdk@4.0.9 build
tsc -p tsconfig.build.json,
agent-relay@4.0.9 build
npm run clean && npm run build:rust && turbo run build --filter='./packages/*' && tsc

agent-relay@4.0.9 clean
rm -rf dist && find packages -maxdepth 2 -name dist -type d -exec rm -rf {} + 2>/dev/null || true

agent-relay@4.0.9 build:rust
if command -v ~/.cargo/bin/cargo >/dev/null 2>&1; then ~/.cargo/bin/cargo build --release --bin agent-relay-broker && mkdir -p packages/sdk/bin && cp target/release/agent-relay-broker packages/sdk/bin/agent-relay-broker.new && mv -f packages/sdk/bin/agent-relay-broker.new packages/sdk/bin/agent-relay-broker && echo '✓ broker binary (agent-relay-broker) built and copied to packages/sdk/bin/'; else echo '⚠ Rust not installed, using prebuilt binaries from bin/'; fi

✓ broker binary (agent-relay-broker) built and copied to packages/sdk/bin/
• Packages in scope: @agent-relay/acp-bridge, @agent-relay/brand, @agent-relay/cloud, @agent-relay/config, @agent-relay/gateway, @agent-relay/hooks, @agent-relay/memory, @agent-relay/openclaw, @agent-relay/policy, @agent-relay/sdk, @agent-relay/telemetry, @agent-relay/trajectory, @agent-relay/user-directory, @agent-relay/utils
• Running build in 14 packages
• Remote caching disabled, using shared worktree cache
@agent-relay/telemetry:build: cache hit, suppressing logs 3c1301f09cf0db0f
@agent-relay/config:build: cache hit, suppressing logs eb6fbfdd36e22e6d
@agent-relay/trajectory:build: cache hit, suppressing logs ca3dad063f36471b
@agent-relay/policy:build: cache hit, suppressing logs 83b91767d5ad568b
@agent-relay/cloud:build: cache hit, suppressing logs 706a52a538acc8a3
@agent-relay/utils:build: cache hit, suppressing logs 4788a7b192c4ac29
@agent-relay/user-directory:build: cache hit, suppressing logs 7353c3884c75bb4f
@agent-relay/sdk:build: cache hit, suppressing logs be79734dddd94ff7
@agent-relay/acp-bridge:build: cache hit, suppressing logs 9d6a0f94d62a5961
@agent-relay/gateway:build: cache hit, suppressing logs 610b7cf1e89e3466
@agent-relay/hooks:build: cache hit, suppressing logs 89c13a1a37ca36cf
@agent-relay/memory:build: cache hit, suppressing logs f01d7993b20f8cae
@agent-relay/openclaw:build: cache hit, suppressing logs 770ee9562893877d

Tasks: 13 successful, 13 total
Cached: 13 cached, 13 total
Time: 116ms >>> FULL TURBO)\n\nThe implementation agents previously produced useful local changes, but in the clean isolated PR worktree the durable, reproducible fixes that remained were the workflow-execution fixes above. This update makes PR #708 runnable/reproducible instead of failing on startup/build-order issues.

devin-ai-integration[bot]

This comment was marked as resolved.

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 11 additional findings in Devin Review.

Open in Devin Review

Comment thread workflows/relay-fix-workflow.ts Outdated
Comment on lines +11 to +17
.agent('lead', {
cli: 'claude',
preset: 'lead',
role: 'Relay fix lead coordinating diagnosis and acceptance checks',
model: ClaudeModels.SONNET,
retries: 2,
})
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.

🟡 lead agent is defined but never referenced by any step

The lead agent is configured at lines 11-17 with ClaudeModels.SONNET, but no step in the workflow uses agent: 'lead'. The three agent-based steps use impl-a (line 69), impl-b (line 94), and reviewer (line 216). This suggests either the lead agent definition is dead code, or a step that should use the lead agent is missing (e.g., a planning/coordination step that was intended to consume the plan document).

Open in Devin Review

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Resolved — the workflows/relay-fix-workflow.ts file was removed from the repo in commit d283ddd. The unused lead agent definition is no longer present.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@khaliqgant khaliqgant force-pushed the miya/relay-fix-workflow branch from d3ab5d1 to d283ddd Compare April 11, 2026 13:10
Missed by the workflow (build:esm sub-script not caught in diagnosis).
Aligns utils with the rest of the packages.
Instead of each package independently pinning typescript@5.7.3 via npx,
use a single exact version at root (5.9.3) and let all packages resolve
tsc via npx from node_modules/.bin. This means one version to update,
zero hardcoded version strings in build scripts.
npx tsc resolves a package named 'tsc' on npm (v2.0.4, wrong package).
Plain 'tsc' in an npm script resolves from node_modules/.bin/tsc, which
is the root-hoisted typescript compiler.
Package-local npm install does not install typescript (now root-only).
Install at root so the workspace hoists tsc to node_modules/.bin, then
invoke via npm run -w which resolves from the workspace root.
@khaliqgant khaliqgant merged commit 2c2d2cf into main Apr 11, 2026
57 of 58 checks passed
@khaliqgant khaliqgant deleted the miya/relay-fix-workflow branch April 11, 2026 14:14
miyaontherelay pushed a commit that referenced this pull request Apr 11, 2026
Implements the fixes that PR #708's workflow was meant to produce but
failed to execute (trajectory traj_1775820542976_5e67a482 aborted at
plan-fixes with "agent already exists", skipping all 7 downstream steps).

- install.sh: harden broker/dashboard binary verification with shared
  verify_downloaded_executable helper and failure-reason tracking
- src/cli/commands/messaging.ts: add broker history path so `history`
  works without RELAY_API_KEY; resolve sender via AGENT_RELAY_SENDER;
  fall back to workspace key from broker session
- src/listen_api.rs + main.rs: add /api/history/messages endpoint and
  ListenApiRequest::History variant backing the CLI path
- packages/sdk/src/client.ts: expose getMessageHistory on the SDK client
- tests updated to cover the new paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@khaliqgant khaliqgant restored the miya/relay-fix-workflow branch April 11, 2026 19:56
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.

2 participants