Skip to content

[DEV-58] Fleet workspace relay connect: register multi-repo and multi-team ingest sources - #37

Closed
danii1 wants to merge 3 commits into
mainfrom
feature/dev-58
Closed

[DEV-58] Fleet workspace relay connect: register multi-repo and multi-team ingest sources#37
danii1 wants to merge 3 commits into
mainfrom
feature/dev-58

Conversation

@danii1

@danii1 danii1 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Task: DEV-58

Summary: Fleet workspace relay connect: register multi-repo and multi-team ingest sources

Implementation Details

Now I have a complete picture. Let me set up a task list and implement.
First, refactor relay-connect.ts to support an explicit state-file path (needed for ~/.devintern/relay.json), a force flag, and reusable tracker connect flows:
Now update the state path resolution and load/save helpers:
Now thread statePath/force through ensureRelayToken, mergeConnectState, connectGitHubRepo, and registerRelaySource:
Now extract the tracker connect flows into a reusable connectTrackerSource and simplify runWorkerConnect:
Now replace the inline tracker blocks in runWorkerConnect with calls to the extracted function:
Update the module docstring in relay-connect.ts:
Now add the workspaceRelayPath helper to paths.ts:
Now create the workspace connect module:
I made some mistakes in that draft (a bogus import, a require, and a nonexistent field). Let me fix them:
Now review the full file to verify correctness:
Let me clean up several issues: the awkward target list, casts, unused variable, and make the cwd fallback semantics clearer:
Now update workspace-worker.ts to load relay credentials with workspace-wins precedence:
Now wire the CLI dispatch in index.ts:
Now write the tests:
Two issues: the mock should echo cumulative registrations (as the real control plane does), and more importantly --force with multiple repos would mint one token per repo — a real flaw. I'll split token-minting from registration so a workspace connect mints exactly once:
Now update connectWorkspaceRepos in workspace/connect.ts to mint once, then register all repos:
Now fix the test mock to echo cumulative registrations like the real control plane:
All 8 tests pass. Now update the docs:
Now update relay.md — add the workspace connect section and keep LICENSE_KEY guidance accurate:
Docs look consistent. Now run the full verification suite (format → lint → typecheck → tests):
All green. Let me verify the build and review the final state of the key new file:
One last touch — mention workspace connect in the worker's help for discoverability:
DEV-58 is implemented. All checks pass: format, lint, typecheck, build, and 757/757 tests.

Summary

New: devintern workspace connect (packages/code/src/lib/workspace/connect.ts)

  • workspace connect — mints/stores one fleet pairing at ~/.devintern/relay.json, then registers every [[repos]] GitHub remote (slug from [repos.env].GITHUB_REPO or the remote URL); non-GitHub remotes are skipped with a clear note. Exactly one token mint per run even with N repos; failures are collected and reported.
  • workspace connect linear|asana|trello|azure-devops|jira — reuses the existing tracker flows (credentials read from the shared workspace .env, same as the daemon runs with).
  • workspace connect status — fleet-wide registrations + buffer freshness, flagging workspace repos not yet registered.
  • Idempotent re-connect; existing tokens never silently replaced without --force.

Relay core (relay-connect.ts)

  • Added statePath override on RelayConnectDeps plus loadRelayStateFrom/saveRelayStateTo so state can live outside a checkout; single-repo behavior unchanged.
  • Extracted the five tracker flows into reusable connectTrackerSource; added registerGitHubRepo for token-pre-batched registration.

Worker

  • Fleet mode now resolves credentials via resolveFleetRelayCredentials: workspace ~/.devintern/relay.json wins over legacy cwd .devintern-code/relay.json, so devintern worker starts RelayAcquirer with no per-repo connect.

Docs + tests

  • workspaces.md gains a "Connecting the fleet to the relay" section; stale LICENSE_KEY-as-relay-credential copy retired in both docs (LICENSE_KEY documented as local gate only).
  • 8 new tests covering state path, multi-repo registration, non-GitHub skip, idempotency/--force, tracker source into workspace state, status auth, precedence over checkout state, and unchanged single-repo behavior.

Note: multi-team ([[teams]]) per-source registration remains out of scope per the ticket's dependency on the multi-team polling ticket; this ships single-fleet tracker + multi-repo GitHub as specified.


This PR was automatically created by @devintern/code

devintern-internal[bot] added 2 commits August 22, 2026 03:51
@danii1

danii1 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

🔀 This branch had merge conflicts with main; devintern resolved them and pushed the merge. Please double-check the resolution.

@danii1 danii1 added the blocked label Aug 25, 2026
# Conflicts:
#	docs/code/workspaces.md
#	packages/code/src/lib/workspace/workspace-worker.ts
@danii1

danii1 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

🔀 This branch had merge conflicts with main; devintern resolved them and pushed the merge. Please double-check the resolution.

@danii1 danii1 added devintern-authored Pull request written by DevIntern working its own backlog and removed blocked labels Aug 29, 2026
@danii1

danii1 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #124, which carries forward the useful fleet connect/status behavior on current main while using verified GitHub App pairing, immutable repository IDs, and the canonical workspace relay state. Closing this older implementation because its slug-only register-repo flow and state layout are no longer compatible with the relay architecture.

@danii1 danii1 closed this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devintern-authored Pull request written by DevIntern working its own backlog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant