Repository navigation
[Spec 1940] Stage 1 (in progress): named architects across workspaces on one Tower - #1957
Draft
waleedkadous wants to merge 61 commits into
Draft
waleedkadous wants to merge 61 commits into
waleedkadous wants to merge 61 commits into
Conversation
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…nvitation walkthrough, command surface
…builder rule, stage 2 walkthrough, connections per owner, existing code
…approval (main-31): front-door-only opt-in cut from stage 1
…istyped afx scheme fails with the shape meant
…and the builder rule <workspace>:architect:<name> resolves against live terminals and against the registry, so mail to a named architect in another workspace is delivered, or held when it has no live terminal. - The two resolvers take the structured address and a sender context. They share one workspace lookup and one permission check. - Permission is asked of the sender's workspace for every target. Affinity applies only inside the sender's own workspace. - A builder may name only its own spawning architect. Naming one in another workspace is refused (403) with that workspace's front door. - Malformed addresses are a 400 naming the expected shape. Every afx:// address is refused as cross-Tower messaging not available, by Tower, the cron loader, afx interrupt and afx refresh. - TowerClient.sendMessage's failure result carries Tower's error code. - Carried from the phase 1 review: AgentAddress is a discriminated union, parse errors quote refused values safely, and an address has a length bound.
…live resolver does For bare architect from a builder with no architect of its own, in a workspace with no main, the live resolver refuses with the Spec 755 message and the registry fallback answered 'the first registered'. The send route goes to the registry on any NOT_FOUND, so the builder's mail was held for, and delivered to, an unrelated architect. The registry now gives the live resolver's answer. The starved-mail notice keeps its own last step, the workspace's front door, with unchanged results.
One conflict, in packages/sdk/src/tower-client.ts: main added connectionRefused (#1950) to the same two result shapes this branch added errorCode to. Both fields are kept. One of this branch's SDK tests now expects main's connectionRefused on a refused connection.
…n order (#1633) getArchitects sorted by id, which is the architect's name. With no main, the registry resolver took 'the first registered' off that list and got the alphabetically first architect, where the live resolver reached the first registered: one address, two recipients, depending on whether terminals were up. It now orders main first, then by started_at, as loadState does. The test that pinned the old answer is flipped, as its comment asked.
…st, fix planned for phase 3
…ce and asserts no shellper survives The opt-in latency measurement stopped its Tower without deactivating the workspace, and shellpers outlive Tower by design, so every run left its architect and builder shellpers running. The teardown now deactivates the workspace first, then polls and asserts that no process naming that Tower's socket directory is alive. beforeAll asserts the same listing is non-empty while the terminals are up, so the teardown assertion cannot pass vacuously.
A workspace can be given an address name of its own, the remedy for two workspaces whose directories share a basename. - Migration v20: nullable known_workspaces.address_name, stored lower-cased, with a partial unique index as a backstop. - utils/workspace-address.ts holds every naming rule: which names may be set, which workspace a name refers to, and what a workspace's own name is. It takes the registered rows and the running workspaces as arguments. - The resolvers' workspace lookup calls it in place of the basename match. An explicit name wins and belongs to its workspace whether or not it is running; a named workspace no longer answers to its basename; two unnamed workspaces with one basename fail as ambiguous, naming both paths and the command. The name table is read only for an address that names a workspace. - PUT /api/workspaces/:encodedPath/address-name, TowerClient setWorkspaceAddressName, and afx workspace name <name> / --clear. - The Windows path merge keeps the explicit name on the surviving row.
…d, five unrelated files pass alone; real-Tower transcript
- Remove the 64-character limit on a workspace name: the spec gives none. - The name route answers 500 when the write stored nothing and 409 NAME_TAKEN when the unique index refuses it, where it used to answer 200 or throw. - Errors about a workspace call it what the sender wrote, not its directory name, so they agree with the front-door hint beside them.
…be written in an address A name is refused at set time when its front door, <name>:architect, would not pass the shared parser. The check formats that address with the shared formatter and reads it back, so the limit is the parser's own (the length of an address) and the naming module holds no number. tryFormatAddress is the formatter's answer as a value; formatAddress calls it and throws exactly as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft, opened early for CI. This pull request is not ready for review. It was opened part-way through implementation so that GitHub runs the full test suite on a clean runner, under the owner's standing ruling main-32 (a green GitHub run may stand in for porch's local tests check when the local suite fails only under machine load). The review phase finishes this pull request: the description below will be replaced, and the review document added, before it is marked ready.
What this is
Stage 1 of issue #1940 (Tower-to-Tower messaging: addressing, discovery, security model): named architects addressable across workspaces on one Tower. No second Tower, no transport, no Codev Cloud.
Spec:
codev/specs/1940-tower-to-tower-messaging-proto.mdPlan:
codev/plans/1940-tower-to-tower-messaging-proto.mdWhere it stands
In the branch so far
@cluesmith/codev-sdk/address, with the structuredAgentAddresswire type incodev-types, and one table of cases run by the SDK,packages/codevand the VS Code extension.<workspace>:architect:<name>resolves against live terminals and against the registry, so mail to a named architect in another workspace is delivered, or held when it has no live terminal.afx://address is refused as cross-Tower messaging not available.Adjacent bugs fixed in place
Both are older than this branch and were found by review of phase 2.
architect, the registry answered "the first registered" where the live resolver refuses (a builder whose spawning architect has gone, or a legacy builder, in a workspace with nomain). The send route consults the registry on any not-found, so that mail was held for, and then delivered to, an architect the builder had nothing to do with. The registry now refuses exactly where the live resolver does.getArchitectssorted by name, so with nomainan offline hold named the alphabetically first architect where a live send reached the first registered. It now ordersmainfirst, then by start time, asloadStatedoes. This also means a workspace's sibling architects are relaunched in registration order at workspace start.Why the draft exists now, and the local check that was skipped
On
d106d3984, porch's local tests check and one full local run failed with 92 timeouts in 17 test files, none touched by this branch, while the machine's load average was between 33 and 49. The same suite passed in full twice on the preceding commit.Under the owner's ruling main-32, phase 2's local full-suite check was skipped (porch's build check still ran), on these grounds:
6804f57c7(this branch withmainmerged in). The architect checked the run.mainwas merged into the branch (6df1df753) because the branch conflicted with it and GitHub runs no checks on a conflicting pull request. One conflict,packages/sdk/src/tower-client.ts: both sides added a field to the same two result shapes, and both are kept.The details are in
codev/state/spir-1940_thread.md.