From 637d634fa92d37a69c2d8219f726eeb8601118b3 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 13:50:57 +0000 Subject: [PATCH 01/31] Report failed attachment uploads from the CLI A shadowed error variable meant a rejected upload printed null and exited successfully. Return the upload error instead. --- cmd/agentintercom/attachment.go | 3 +++ cmd/agentintercom/attachment_test.go | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/cmd/agentintercom/attachment.go b/cmd/agentintercom/attachment.go index a169d39..f2cc955 100644 --- a/cmd/agentintercom/attachment.go +++ b/cmd/agentintercom/attachment.go @@ -80,6 +80,9 @@ func attachmentCommand(args []string, in io.Reader, out io.Writer) error { return errors.New("attachment exceeds 16 MiB") } result, err = client.UploadAttachment(ctx, bus.UploadAttachmentInput{Name: *name, MediaType: *media, IdempotencyKey: *key}, data) + if err != nil { + return err + } case "download": if *file == "" || *file == "-" { return errors.New("download requires --file ; bytes are never printed to the terminal") diff --git a/cmd/agentintercom/attachment_test.go b/cmd/agentintercom/attachment_test.go index edc5142..4977bd5 100644 --- a/cmd/agentintercom/attachment_test.go +++ b/cmd/agentintercom/attachment_test.go @@ -56,4 +56,11 @@ func TestAttachmentCLIUploadDownloadAndNoOverwrite(t *testing.T) { if bytes.Contains(out.Bytes(), data) { t.Fatal("binary bytes were printed to the terminal") } + + t.Setenv("OCTOBER_BUS_AGENT_TOKEN", "invalid-agent-token") + out.Reset() + err = attachmentCommand([]string{"upload", "--address", server.URL, "--file", "-", "--name", "rejected.bin"}, bytes.NewReader(data), &out) + if err == nil { + t.Fatalf("rejected upload reported success: %q", out.String()) + } } From b9c70b982a80a20672af84ce5022bfea6bacde09 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 13:51:35 +0000 Subject: [PATCH 02/31] Fix the README link to connection options --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d72e2e4..00cc62e 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ npx agentintercom-cli@0.2.0 demo **Release note:** Version `0.2.0` is currently a release candidate. Use the version shown above when installing, since npm's `latest` tag still points to a placeholder. -On Windows or using a different agent? Check out the [connection options](https://github.com/october-dev/agentintercom#ways-to-connect). +On Windows or using a different agent? Check out the [connection options](https://github.com/october-dev/agentintercom/blob/main/docs/connect-sessions.md). Need help? See the [installation guide](https://github.com/october-dev/agentintercom/blob/main/docs/installation.md). From ee9190eb3f8bcb14e5a718d2fd6abc14dd6c4690 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 13:54:25 +0000 Subject: [PATCH 03/31] Refuse runtime discovery files another local user could plant When XDG_RUNTIME_DIR is unset the runtime directory lives under the shared temporary directory. Clients now read bus.json only when it and its directory belong to the current user and are not group or world writable, and the daemon refuses a runtime directory owned by another user instead of failing with a permission error. --- bus/daemon.go | 41 +++++++++++++++++++++++- bus/file_lock_unix.go | 8 +++++ bus/file_lock_windows.go | 4 +++ bus/run_file_unix_test.go | 66 +++++++++++++++++++++++++++++++++++++++ docs/threat-model.md | 2 +- 5 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 bus/run_file_unix_test.go diff --git a/bus/daemon.go b/bus/daemon.go index afee3fe..c065aa9 100644 --- a/bus/daemon.go +++ b/bus/daemon.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "io" "net/url" "os" "os/user" @@ -71,7 +72,7 @@ func DefaultDaemonPaths() (DaemonPaths, error) { } func ReadRunFile(path string) (RunFile, error) { - data, err := os.ReadFile(path) + data, err := readPrivateRunFile(path) if err != nil { return RunFile{}, err } @@ -86,6 +87,41 @@ func ReadRunFile(path string) (RunFile, error) { return run, nil } +// readPrivateRunFile reads the discovery file only when it and its directory +// belong to the current user. Without this check another local account could +// plant a run file in a shared temporary directory and receive the scope +// tokens that clients send to the advertised address. +func readPrivateRunFile(path string) ([]byte, error) { + invalid := errors.New("Agent Intercom run file is not private to the current user") + directory, err := os.Lstat(filepath.Dir(path)) + if err != nil { + return nil, err + } + if directory.Mode()&os.ModeSymlink != 0 || !directory.IsDir() || !ownedByCurrentUser(directory) || (runtime.GOOS != "windows" && directory.Mode().Perm()&0o022 != 0) { + return nil, invalid + } + before, err := os.Lstat(path) + if err != nil { + return nil, err + } + if !before.Mode().IsRegular() || !ownedByCurrentUser(before) || (runtime.GOOS != "windows" && before.Mode().Perm()&0o077 != 0) { + return nil, invalid + } + file, err := os.Open(path) + if err != nil { + return nil, err + } + defer file.Close() + after, err := file.Stat() + if err != nil { + return nil, err + } + if !os.SameFile(before, after) { + return nil, invalid + } + return io.ReadAll(io.LimitReader(file, 1<<16)) +} + func writeRunFile(path string, run RunFile) error { data, err := json.MarshalIndent(run, "", " ") if err != nil { @@ -137,6 +173,9 @@ func secureDirectory(path string) error { if info.Mode()&os.ModeSymlink != 0 || !info.IsDir() { return fmt.Errorf("%s must be a real directory", path) } + if !ownedByCurrentUser(info) { + return fmt.Errorf("%s is owned by another user; set OCTOBER_BUS_RUNTIME_DIR or XDG_RUNTIME_DIR to a private directory", path) + } if runtime.GOOS != "windows" { if err := os.Chmod(path, 0o700); err != nil { return err diff --git a/bus/file_lock_unix.go b/bus/file_lock_unix.go index 0622243..778f0d5 100644 --- a/bus/file_lock_unix.go +++ b/bus/file_lock_unix.go @@ -20,3 +20,11 @@ func validateDatabaseLinks(_ string, info os.FileInfo) error { } return nil } + +// ownedByCurrentUser reports whether info describes a file owned by the +// effective user. Discovery files may live under a shared temporary +// directory, so another local account must not be able to plant them. +func ownedByCurrentUser(info os.FileInfo) bool { + stat, ok := info.Sys().(*syscall.Stat_t) + return ok && int(stat.Uid) == os.Geteuid() +} diff --git a/bus/file_lock_windows.go b/bus/file_lock_windows.go index 55a52fb..f45efd1 100644 --- a/bus/file_lock_windows.go +++ b/bus/file_lock_windows.go @@ -36,3 +36,7 @@ func validateDatabaseLinks(path string, _ os.FileInfo) error { } return nil } + +// ownedByCurrentUser is not enforced on Windows, where the runtime directory +// is created under the per-user temporary directory. +func ownedByCurrentUser(os.FileInfo) bool { return true } diff --git a/bus/run_file_unix_test.go b/bus/run_file_unix_test.go new file mode 100644 index 0000000..0c7dbe7 --- /dev/null +++ b/bus/run_file_unix_test.go @@ -0,0 +1,66 @@ +//go:build darwin || linux + +package bus + +import ( + "os" + "path/filepath" + "testing" + "time" +) + +func TestReadRunFileRefusesFilesOtherUsersCanPlant(t *testing.T) { + write := func(t *testing.T, directoryMode, fileMode os.FileMode) string { + t.Helper() + directory := filepath.Join(t.TempDir(), "run") + if err := os.Mkdir(directory, 0o700); err != nil { + t.Fatal(err) + } + path := filepath.Join(directory, "bus.json") + run := RunFile{ProtocolVersion: ProtocolVersion, Address: "http://127.0.0.1:1", PID: os.Getpid(), StartedAt: time.Now().UTC().Format(time.RFC3339Nano), AdminToken: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"} + if err := writeRunFile(path, run); err != nil { + t.Fatal(err) + } + if err := os.Chmod(path, fileMode); err != nil { + t.Fatal(err) + } + if err := os.Chmod(directory, directoryMode); err != nil { + t.Fatal(err) + } + return path + } + if _, err := ReadRunFile(write(t, 0o700, 0o600)); err != nil { + t.Fatalf("private run file was refused: %v", err) + } + for name, modes := range map[string][2]os.FileMode{ + "group-readable file": {0o700, 0o640}, + "world-writable directory": {0o777, 0o600}, + } { + if _, err := ReadRunFile(write(t, modes[0], modes[1])); err == nil { + t.Fatalf("%s was accepted", name) + } + } + target := write(t, 0o700, 0o600) + link := filepath.Join(filepath.Dir(target), "link.json") + if err := os.Symlink(target, link); err != nil { + t.Fatal(err) + } + if _, err := ReadRunFile(link); err == nil { + t.Fatal("symlinked run file was accepted") + } + if os.Geteuid() == 0 { + planted := write(t, 0o700, 0o600) + if err := os.Chown(planted, 65534, 65534); err != nil { + t.Skip("cannot change file ownership:", err) + } + if _, err := ReadRunFile(planted); err == nil { + t.Fatal("run file owned by another user was accepted") + } + if err := os.Chown(filepath.Dir(planted), 65534, 65534); err != nil { + t.Fatal(err) + } + if err := secureDirectory(filepath.Dir(planted)); err == nil { + t.Fatal("runtime directory owned by another user was accepted") + } + } +} diff --git a/docs/threat-model.md b/docs/threat-model.md index 2f1a67f..d97b458 100644 --- a/docs/threat-model.md +++ b/docs/threat-model.md @@ -37,7 +37,7 @@ Adapters and harnesses remain responsible for their own model access, files, too ## Local process risk -The runtime and data directories request owner-only permissions where the operating system supports them. A malicious process already running as the same operating-system user may still be able to access local files, inspect memory, or control sibling processes. Agent Intercom is not a sandbox against the local user account. +The runtime and data directories request owner-only permissions where the operating system supports them. Without `XDG_RUNTIME_DIR` or `OCTOBER_BUS_RUNTIME_DIR`, the Unix runtime directory falls back to the system temporary directory; the daemon refuses a runtime directory owned by another user, and clients ignore a discovery file that another user owns or could have replaced. A malicious process already running as the same operating-system user may still be able to access local files, inspect memory, or control sibling processes. Agent Intercom is not a sandbox against the local user account. Do not place scope or admin credentials in model context. Give a harness only its execution-bound agent token when possible. From feb949590213b52ef26df8d05b941b5df079a32c Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 13:57:13 +0000 Subject: [PATCH 04/31] Recover OAuth client capacity from abandoned registrations Dynamic client registration is unauthenticated and clients were never removed, so filling the 50,000-client cap blocked new connections permanently. At capacity, evict the oldest clients that are over a day old and hold no pending request or token. --- bus/hosted_oauth.go | 32 ++++++++++++++++++++++++++++++-- bus/hosted_oauth_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/bus/hosted_oauth.go b/bus/hosted_oauth.go index ef316ab..c93927b 100644 --- a/bus/hosted_oauth.go +++ b/bus/hosted_oauth.go @@ -118,8 +118,7 @@ func (h *HostedServer) oauthRegister(w http.ResponseWriter, r *http.Request) { return } defer tx.Rollback() - var count int - if err := tx.QueryRowContext(r.Context(), "SELECT COUNT(*) FROM oauth_clients").Scan(&count); err != nil || count >= 50000 { + if !reserveOAuthClientCapacity(r.Context(), tx) { oauthFailure(w, 503, "temporarily_unavailable", "Registration capacity is unavailable") return } @@ -332,3 +331,32 @@ func (h *HostedServer) oauthConsent(ctx context.Context, user HostedUser, w http redirect.RawQuery = query.Encode() return map[string]string{"redirectUrl": redirect.String()}, nil } + +// hostedOAuthClientLimit bounds anonymous dynamic client registration. +var hostedOAuthClientLimit = 50000 + +// reserveOAuthClientCapacity reports whether another client may register. +// Registration is unauthenticated, so at capacity it first evicts the oldest +// clients that are more than a day old and hold no pending request or token. +// Such a client can no longer authorize anything without a new flow, and +// MCP clients register again when their client ID is unknown. +func reserveOAuthClientCapacity(ctx context.Context, tx sqlExecutor) bool { + var count int + if err := tx.QueryRowContext(ctx, "SELECT COUNT(*) FROM oauth_clients").Scan(&count); err != nil { + return false + } + if count < hostedOAuthClientLimit { + return true + } + cutoff := nowMillis() - int64(24*time.Hour/time.Millisecond) + if _, err := tx.ExecContext(ctx, `DELETE FROM oauth_clients WHERE client_id IN (SELECT c.client_id FROM oauth_clients c WHERE c.created_at Date: Fri, 27 Nov 2026 13:57:46 +0000 Subject: [PATCH 05/31] Include the issuer in OAuth authorization responses Advertise and send the RFC 9207 iss parameter so MCP clients that talk to several authorization servers can detect mix-up attacks. --- bus/hosted_oauth.go | 4 +++- bus/hosted_oauth_test.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bus/hosted_oauth.go b/bus/hosted_oauth.go index c93927b..64d9b99 100644 --- a/bus/hosted_oauth.go +++ b/bus/hosted_oauth.go @@ -48,7 +48,7 @@ func (h *HostedServer) registerOAuthRoutes() { h.routes.HandleFunc("GET /.well-known/oauth-protected-resource", metadata) h.routes.HandleFunc("GET /.well-known/oauth-protected-resource/mcp", metadata) h.routes.HandleFunc("GET /.well-known/oauth-authorization-server", func(w http.ResponseWriter, r *http.Request) { - writeJSON(w, 200, map[string]any{"issuer": h.publicURL, "authorization_endpoint": h.publicURL + "/oauth/authorize", "token_endpoint": h.publicURL + "/oauth/token", "registration_endpoint": h.publicURL + "/oauth/register", "revocation_endpoint": h.publicURL + "/oauth/revoke", "response_types_supported": []string{"code"}, "grant_types_supported": []string{"authorization_code", "refresh_token"}, "token_endpoint_auth_methods_supported": []string{"none", "client_secret_basic", "client_secret_post"}, "code_challenge_methods_supported": []string{"S256"}, "scopes_supported": []string{hostedOAuthScope}}) + writeJSON(w, 200, map[string]any{"issuer": h.publicURL, "authorization_endpoint": h.publicURL + "/oauth/authorize", "token_endpoint": h.publicURL + "/oauth/token", "registration_endpoint": h.publicURL + "/oauth/register", "revocation_endpoint": h.publicURL + "/oauth/revoke", "response_types_supported": []string{"code"}, "grant_types_supported": []string{"authorization_code", "refresh_token"}, "token_endpoint_auth_methods_supported": []string{"none", "client_secret_basic", "client_secret_post"}, "code_challenge_methods_supported": []string{"S256"}, "scopes_supported": []string{hostedOAuthScope}, "authorization_response_iss_parameter_supported": true}) }) h.routes.HandleFunc("POST /oauth/register", h.oauthRegister) h.routes.HandleFunc("GET /oauth/authorize", h.oauthAuthorize) @@ -295,6 +295,8 @@ func (h *HostedServer) oauthConsent(ctx context.Context, user HostedUser, w http if pending.state != "" { query.Set("state", pending.state) } + // RFC 9207 lets clients that use several authorization servers detect mix-up. + query.Set("iss", h.publicURL) if input.Approve { if _, err := hostedMember(ctx, tx, input.WorkspaceID, user.ID); err != nil { return nil, err diff --git a/bus/hosted_oauth_test.go b/bus/hosted_oauth_test.go index 3ac0a8c..136ec04 100644 --- a/bus/hosted_oauth_test.go +++ b/bus/hosted_oauth_test.go @@ -106,7 +106,7 @@ func (f *hostedOAuthFixture) approveReplacement(id, replaceID string) string { requireNoError(f.t, json.Unmarshal(response.Body.Bytes(), &envelope)) u, err := url.Parse(envelope.Result.URL) requireNoError(f.t, err) - require(f.t, u.Scheme == "http" && u.Host == "127.0.0.1:5555" && u.Query().Get("state") == "state-test", "consent redirected elsewhere") + require(f.t, u.Scheme == "http" && u.Host == "127.0.0.1:5555" && u.Query().Get("state") == "state-test" && u.Query().Get("iss") == "https://bus.example.test", "consent redirected elsewhere") return u.Query().Get("code") } From 34550130d0c8c55acd4ed0927768478e8113facc Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 13:58:36 +0000 Subject: [PATCH 06/31] Let workspace admins revoke only member invitations Admins can issue member invitations but could revoke any pending invitation, including admin invitations from the owner. Apply the same role rule to revocation as to issuance. --- bus/hosted_accounts_test.go | 22 ++++++++++++++++++++++ bus/hosted_views.go | 13 +++++++++++++ 2 files changed, 35 insertions(+) diff --git a/bus/hosted_accounts_test.go b/bus/hosted_accounts_test.go index f3fd077..4af2189 100644 --- a/bus/hosted_accounts_test.go +++ b/bus/hosted_accounts_test.go @@ -227,3 +227,25 @@ func TestHostedAllowanceCountsDeliveriesNotRetriesOrReplies(t *testing.T) { _, err = a.runtime.Heartbeat(ctx, x.AgentToken, HeartbeatInput{Lifecycle: LifecycleIdle}) requireCode(t, err, CodeUnauthenticated) } + +func TestHostedAdminsRevokeOnlyInvitationsTheyCanIssue(t *testing.T) { + ctx, a := hostedTestAccounts(t) + owner, admin := hostedTestUser(t, "invite-owner"), hostedTestUser(t, "invite-admin") + w, err := a.CreateWorkspace(ctx, owner, "Invitation roles") + requireNoError(t, err) + defer a.runtime.DeleteScope(context.Background(), w.ID) + promotion, err := a.Invite(ctx, owner, w.ID, admin.Email, "admin") + requireNoError(t, err) + _, err = a.AcceptInvite(ctx, admin, promotion.Token) + requireNoError(t, err) + adminInvite, err := a.Invite(ctx, owner, w.ID, "second-admin@example.test", "admin") + requireNoError(t, err) + memberInvite, err := a.Invite(ctx, admin, w.ID, "member@example.test", "member") + requireNoError(t, err) + requireCode(t, a.RevokeInvite(ctx, admin, w.ID, adminInvite.ID), CodePermissionDenied) + requireNoError(t, a.RevokeInvite(ctx, admin, w.ID, memberInvite.ID)) + requireNoError(t, a.RevokeInvite(ctx, owner, w.ID, adminInvite.ID)) + pending, err := a.Invites(ctx, owner, w.ID) + requireNoError(t, err) + require(t, len(pending) == 0, "revoked invitations remain pending: %#v", pending) +} diff --git a/bus/hosted_views.go b/bus/hosted_views.go index acbe38f..c4420f5 100644 --- a/bus/hosted_views.go +++ b/bus/hosted_views.go @@ -2,6 +2,8 @@ package bus import ( "context" + "database/sql" + "errors" "net/http" ) @@ -137,6 +139,17 @@ func (a *HostedAccounts) RevokeInvite(ctx context.Context, user HostedUser, scop if role == "member" { return Errorf(CodePermissionDenied, "An admin or owner must manage invitations") } + var inviteRole string + switch err := tx.QueryRowContext(ctx, "SELECT role FROM hosted_invites WHERE scope_id=? AND invite_id=?", scopeID, id).Scan(&inviteRole); { + case errors.Is(err, sql.ErrNoRows): + return tx.Commit() + case err != nil: + return err + } + // Admins may revoke only the invitations their role can issue. + if role != "owner" && inviteRole != "member" { + return Errorf(CodePermissionDenied, "Your workspace role cannot revoke this invitation") + } _, err = tx.ExecContext(ctx, "UPDATE hosted_invites SET revoked_at=? WHERE scope_id=? AND invite_id=? AND revoked_at=0", nowMillis(), scopeID, id) if err != nil { return err From 9166165caceb87322420bc30297fef7e3d7cfab3 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 13:59:17 +0000 Subject: [PATCH 07/31] Update the Desktop integration guide to current binary and artifact names --- docs/desktop-remote-integration.md | 42 +++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/desktop-remote-integration.md b/docs/desktop-remote-integration.md index 36ed207..8f2f8c2 100644 --- a/docs/desktop-remote-integration.md +++ b/docs/desktop-remote-integration.md @@ -13,7 +13,7 @@ ownership, commands, artifacts, evidence and what remains on the Desktop side. | Component | Owns | | --- | --- | -| October Bus native helper (`october-bus`) | MCP bridge over a controller-managed connection, per-request credential reread, next-call reconnect without replaying a failed mutation, Claude/Codex lifecycle hook, bounded setup check, hosted-gateway self-registration. | +| Agent Intercom native helper (`agentintercom`) | MCP bridge over a controller-managed connection, per-request credential reread, next-call reconnect without replaying a failed mutation, Claude/Codex lifecycle hook, bounded setup check, hosted-gateway self-registration. | | October Desktop / Core | Canvas identity, execution credentials and their renewal/retirement, the connection file writer, SSH supervision and the loopback route, tmux ownership and foreground proof, safe input delivery, helper installation, Settings cards, readiness decisions. | | October Cloud controller | Hosted authority, HTTPS worker MCP/hook routes, worker admission and lifecycle while the laptop is off. Deployment and live qualification remain controller work. | @@ -28,10 +28,10 @@ All three read the same connection file, from `--connection-file` or | Command | Role | Exit | | --- | --- | --- | -| `october-bus mcp stdio --connection-file ` | Long-lived MCP bridge for the harness. Refuses if launcher credentials, local registration flags or `--remote` are also present. | Non-zero only on startup failure; runtime failures surface as tool errors plus one stderr line per failure class. | -| `october-bus hook [--connection-file ] [claude\|codex]` | Per-event lifecycle reporter, invoked by the harness. Same argv shape as Desktop's `bus-hook.mjs` (` []`). | Always 0. Silent and offline when no file is named. | -| `october-bus mcp check [--connection-file ] [--json]` | Setup diagnostic: file validation plus one JSON-RPC `ping`. Never `initialize`, never touches the inbox. | 0 on `ok`, 1 otherwise. | -| `october-bus version [--json]` (or `--version`) | Version pin verification: `{"runtimeVersion","protocolVersion"}`. | 0 | +| `agentintercom mcp stdio --connection-file ` | Long-lived MCP bridge for the harness. Refuses if launcher credentials, local registration flags or `--remote` are also present. | Non-zero only on startup failure; runtime failures surface as tool errors plus one stderr line per failure class. | +| `agentintercom hook [--connection-file ] [claude\|codex]` | Per-event lifecycle reporter, invoked by the harness. Same argv shape as Desktop's `bus-hook.mjs` (` []`). | Always 0. Silent and offline when no file is named. | +| `agentintercom mcp check [--connection-file ] [--json]` | Setup diagnostic: file validation plus one JSON-RPC `ping`. Never `initialize`, never touches the inbox. | 0 on `ok`, 1 otherwise. | +| `agentintercom version [--json]` (or `--version`) | Version pin verification: `{"runtimeVersion","protocolVersion"}`. | 0 | Failure classes for all of them: `invalid-configuration`, `expired-credential`, `retired-execution`, `unreachable`, `refused-credential`, `authority-unavailable`, @@ -126,12 +126,12 @@ Release artifacts (`.github/workflows/release.yml`, tag `v`): | Artifact | Contents | | --- | --- | -| `october-bus__linux_amd64.tar.gz`, `october-bus__linux_arm64.tar.gz` | Directory `october-bus__linux_/` containing `october-bus`, `october-bus-conformance`, `LICENSE`, `README.md`, `docs/`, `spec/`, `adapters/`, `compatibility/`, `assets/`. | +| `agentintercom__linux_amd64.tar.gz`, `agentintercom__linux_arm64.tar.gz` | Directory `agentintercom__linux_/` containing `agentintercom`, `agentintercom-conformance`, `LICENSE`, `README.md`, `docs/`, `spec/`, `adapters/`, `compatibility/`, `assets/`. | | `checksums.txt` | `sha256sum` lines for every release file; verify with `sha256sum -c`. | | `remote-bus-runtime.json` | Desktop's version-1 pin manifest: runtime/protocol versions, exact source commit, clean-build qualification, and archive/binary SHA-256 for both Linux architectures. | | `LICENSE` | Standalone license for redistributors, also included inside each archive. | -| `october-bus_v_linux_.spdx.json` | SPDX SBOM. | -| GitHub build-provenance attestation | Verify with `gh attestation verify --repo october-dev/october-bus`. | +| `agentintercom_v_linux_.spdx.json` | SPDX SBOM. | +| GitHub build-provenance attestation | Verify with `gh attestation verify --repo october-dev/agentintercom`. | The release workflow smoke-tests (`version`, `version --json`, `demo`) the Linux amd64 archive on `ubuntu-latest` and the Linux arm64 archive on @@ -143,15 +143,15 @@ Install on a worker (the controller performs this over SSH; users do nothing): ```sh VERSION=; ARCH= -ARCHIVE="october-bus_${VERSION}_linux_${ARCH}.tar.gz" +ARCHIVE="agentintercom_${VERSION}_linux_${ARCH}.tar.gz" # Download the archive and checksums.txt on the laptop from the GitHub release, # verify, then stream the archive over SSH stdin as the existing installer does. sha256sum --ignore-missing -c checksums.txt # must print: ${ARCHIVE}: OK -gh attestation verify "${ARCHIVE}" --repo october-dev/october-bus -tar -xzf "${ARCHIVE}" "october-bus_${VERSION}_linux_${ARCH}/october-bus" -install -m 0755 "october-bus_${VERSION}_linux_${ARCH}/october-bus" \ - ~/.october/servers//versions//bin/october-bus -~/.october/servers//versions//bin/october-bus version --json +gh attestation verify "${ARCHIVE}" --repo october-dev/agentintercom +tar -xzf "${ARCHIVE}" "agentintercom_${VERSION}_linux_${ARCH}/agentintercom" +install -m 0755 "agentintercom_${VERSION}_linux_${ARCH}/agentintercom" \ + ~/.october/servers//versions//bin/agentintercom +~/.october/servers//versions//bin/agentintercom version --json # {"protocolVersion":"0.1","runtimeVersion":""} ``` @@ -167,18 +167,18 @@ integration; not a release): ```sh VERSION=$(node -p "require('./sdk/typescript/package.json').version") for ARCH in amd64 arm64; do - DIR="october-bus_${VERSION}_linux_${ARCH}"; mkdir -p "dist/${DIR}" + DIR="agentintercom_${VERSION}_linux_${ARCH}"; mkdir -p "dist/${DIR}" CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -trimpath \ - -ldflags "-s -w -X github.com/october-dev/october-bus/bus.Version=${VERSION}" \ - -o "dist/${DIR}/october-bus" ./cmd/october-bus + -ldflags "-s -w -X github.com/october-dev/agentintercom/bus.Version=${VERSION}" \ + -o "dist/${DIR}/agentintercom" ./cmd/agentintercom tar -C dist -czf "dist/${DIR}.tar.gz" "${DIR}" done (cd dist && sha256sum *.tar.gz > checksums.txt) ``` -The optional npm route (`@october-dev/october-bus@0.1.0-next.15` with -`@october-dev/october-bus-linux-{x64,arm64}` optional dependencies, launcher -`cli/october-bus.cjs`) carries the same binary but requires Node 20+ on the +The optional npm route (`agentintercom-cli` with +`@october-dev/agentintercom-linux-{x64,arm64}` optional dependencies, launcher +`cli/agentintercom.cjs`) carries the same binary but requires Node 20+ on the worker; it is documented in [releases.md](releases.md) and is not the managed install path. Nothing was published by this work. @@ -281,7 +281,7 @@ consumer's cloud integration. `isOctoberBusHookCommand`/migration recognition and the Codex trust-hash seeding to the helper form. Existing routes, bodies and envelopes are unchanged, so Core needs no change for hooks. -4. **Installer.** Install the pinned Linux `october-bus` from the release +4. **Installer.** Install the pinned Linux `agentintercom` from the release archive (checksum + attestation verified on the laptop) under the existing `~/.october/servers//versions//` layout; verify `version --json`; show installation, `mcp check` class and agent readiness From 07c9e46008e339b91844531facf57a890c4c3ee3 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:00:24 +0000 Subject: [PATCH 08/31] Keep shared sign-in checks alive when one caller cancels Concurrent requests with the same session token share one Auth lookup. It ran on the first caller's context, so a cancelled request failed every other request waiting on it. --- bus/hosted_identity.go | 4 +++- bus/hosted_identity_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/bus/hosted_identity.go b/bus/hosted_identity.go index 4bdcd52..023d724 100644 --- a/bus/hosted_identity.go +++ b/bus/hosted_identity.go @@ -124,7 +124,9 @@ func (v *SupabaseIdentity) Authenticate(ctx context.Context, token string) (Host return cached.user, nil } result, err, _ := v.pending.Do(digest, func() (any, error) { - request, err := http.NewRequestWithContext(ctx, http.MethodGet, v.origin+"/auth/v1/user", nil) + // Concurrent callers share this lookup, so one caller's cancellation + // must not fail the others. The client timeout still bounds it. + request, err := http.NewRequestWithContext(context.WithoutCancel(ctx), http.MethodGet, v.origin+"/auth/v1/user", nil) if err != nil { return HostedUser{}, err } diff --git a/bus/hosted_identity_test.go b/bus/hosted_identity_test.go index ae6beff..940477e 100644 --- a/bus/hosted_identity_test.go +++ b/bus/hosted_identity_test.go @@ -78,3 +78,32 @@ func TestHostedIdentityRejectsPrivilegedPublicKeys(t *testing.T) { _, err := NewSupabaseIdentity("https://auth.example.test", anon, nil) requireNoError(t, err) } + +func TestHostedIdentitySharedLookupSurvivesOneCallerCancelling(t *testing.T) { + const id = "0b8f6b52-5f7a-4f4e-9d0c-1f2a3b4c5d6e" + arrived, release := make(chan struct{}), make(chan struct{}) + var once atomic.Bool + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if once.CompareAndSwap(false, true) { + close(arrived) + } + <-release + writeJSON(w, 200, map[string]any{"id": id, "email": "shared@example.test", "email_confirmed_at": "2026-01-01T00:00:00Z", "is_anonymous": false}) + })) + defer server.Close() + verifier, err := NewSupabaseIdentity(server.URL, "sb_publishable_fixture_key_for_tests", nil) + requireNoError(t, err) + claims, _ := json.Marshal(map[string]any{"sub": id, "iss": server.URL + "/auth/v1", "aud": "authenticated", "exp": time.Now().Add(time.Hour).Unix(), "role": "authenticated"}) + token := "e30." + base64.RawURLEncoding.EncodeToString(claims) + ".test-signature" + first, cancel := context.WithCancel(context.Background()) + firstDone := make(chan error, 1) + go func() { _, err := verifier.Authenticate(first, token); firstDone <- err }() + <-arrived + secondDone := make(chan error, 1) + go func() { _, err := verifier.Authenticate(context.Background(), token); secondDone <- err }() + time.Sleep(20 * time.Millisecond) + cancel() + close(release) + <-firstDone + requireNoError(t, <-secondDone) +} From 3e5f8875846a3dfa4ca5ddc5523758c8fdd7c562 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:07:08 +0000 Subject: [PATCH 09/31] Mark commands and APIs added after the 0.2.0 candidate The README installs agentintercom-cli@0.2.0, but several documented commands landed later. List them in the changelog and note in each guide that they need a source build until the next release. --- CHANGELOG.md | 25 ++++++++++++++++++++++++- adapters/cursor/README.md | 2 +- docs/cli-messages.md | 4 ++++ docs/connect-sessions.md | 4 +++- sdk/typescript/README.md | 2 +- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 384f9fb..f7e061f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,29 @@ ## Unreleased +Changes on `main` after the `0.2.0` release candidate. They are not in the +published `agentintercom-cli@0.2.0` package; build from source to use them +before the next release. + +- Add `task claim`, `task release`, `task complete` and `task progress` CLI + commands for shared tasks (#196). +- Add `question list` and `question answer` to answer pending agent questions + from a terminal (#195). +- Let `agent run` read the scope token from `--scope-token-file` or + `--scope-token-fd` (#155). +- Add `downloadAttachment` to the TypeScript client, with integrity checks (#197). +- Run the Cursor adapter under `agent run` and let `doctor` find `cursor-agent` + (#209). +- Exit with status 0 for subcommand `--help` (#191). +- Preserve the HTTP status when a Go client error body is not valid JSON (#190). +- Report failed `attachment upload` requests instead of printing `null`. +- Refuse a runtime directory or discovery file owned by another local user. +- Hosted: recover OAuth client registration capacity from abandoned clients, + send the RFC 9207 `iss` authorization response parameter, and limit admins + to revoking member invitations. + +## 0.2.0 (release candidate) + - Use the Agent Intercom product name, `agentintercom` command and `agentintercom-cli` npm package. Move the repository and Go module to `october-dev/agentintercom`. The @@ -14,6 +37,6 @@ - Preserve existing protocol 0.1 health/archive identifiers, local data paths, `OCTOBER_BUS_*` configuration, applied migrations and hosted deployment paths. -These changes are not a claim that an npm release or hosted launch has occurred. +`0.2.0` is published to npm under the `candidate` tag; it is not a hosted launch. See [releases](https://github.com/october-dev/agentintercom/releases) for published versions and [compatibility](compatibility/registry.json) for qualified adapters. diff --git a/adapters/cursor/README.md b/adapters/cursor/README.md index 3937b96..b6e5fd3 100644 --- a/adapters/cursor/README.md +++ b/adapters/cursor/README.md @@ -97,7 +97,7 @@ Doctor probes a separate temporary bridge. Its `hostExecutable` identifies which | Discover and notify | Ask Cursor to call `list_peers` and send `codex-builder` a short `message_peer` with mode `notify`. Ask Codex to call `check_inbox`, then `acknowledge_messages` with the processed IDs. | | Request and reply | Ask Codex to send Cursor a `request` with a fresh `idempotencyKey` and one short `text` context item. Ask Cursor to pull, acknowledge, and send a `response` with `responseTo` set to the request ID. Codex can pull and acknowledge the reply, then check the original ID with `message_receipt`. Its `responseMessageId` should match the reply. | | Share a task | Ask Cursor to call `add_task`, then ask Codex to find the task with `list_tasks`, claim it, and complete it. Cursor can check the final state. | -| Ask a human | Ask Cursor to call `ask_user` with a short question. In the operator terminal, run `agentintercom question list --workspace cursor-demo`, then `agentintercom question answer --workspace cursor-demo --id QUESTION_ID --answer yes` with the returned ID. Have Cursor pull and acknowledge the answer. | +| Ask a human | Ask Cursor to call `ask_user` with a short question. In the operator terminal, run `agentintercom question list --workspace cursor-demo` (newer than `0.2.0`; use a source build), then `agentintercom question answer --workspace cursor-demo --id QUESTION_ID --answer yes` with the returned ID. Have Cursor pull and acknowledge the answer. | Use `check_inbox` between work steps. For a short check use `waitMs=1000`. Queued work waits until the host pulls. Send only the context the peer needs. An incoming request still goes through the recipient's normal permission controls. diff --git a/docs/cli-messages.md b/docs/cli-messages.md index 926ea2e..959f64a 100644 --- a/docs/cli-messages.md +++ b/docs/cli-messages.md @@ -47,6 +47,10 @@ refuse redirects. A CLI connection does not itself wake an idle agent. ## Shared tasks +The `claim`, `release`, `complete` and `progress` commands below are newer than +`agentintercom-cli@0.2.0`; use a [source build](installation.md#build-from-source) +until the next release. + The same two shells can split work through shared tasks. In the first shell: ```sh diff --git a/docs/connect-sessions.md b/docs/connect-sessions.md index 632054f..200a834 100644 --- a/docs/connect-sessions.md +++ b/docs/connect-sessions.md @@ -120,7 +120,9 @@ hosted OAuth support is claimed by generating configuration. ## Answer an agent's question When an agent calls `ask_user`, the question waits for the workspace owner. On a -headless machine you can answer it from a terminal: +headless machine you can answer it from a terminal. The `question` commands are +newer than `agentintercom-cli@0.2.0`; use a +[source build](installation.md#build-from-source) until the next release. ```sh agentintercom question list --workspace my-project diff --git a/sdk/typescript/README.md b/sdk/typescript/README.md index ae45e30..d2a4ac1 100644 --- a/sdk/typescript/README.md +++ b/sdk/typescript/README.md @@ -129,7 +129,7 @@ Generate a new idempotency key for each logical send. Keys remain bound to their `AgentIntercomAgentSession` manages registration, conservative lifecycle state, heartbeat, execution replacement, and shutdown cleanup for adapters that use the TypeScript client. -To use a shared file, download it whole instead of reading chunks yourself: +To use a shared file, download it whole instead of reading chunks yourself (`downloadAttachment` is newer than `0.2.0` and ships in the next release): ```ts const { attachment, data } = await reviewer.downloadAttachment(attachmentId) From 1d7c82723dd57541d307f8da10c96add9004dd2b Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:07:54 +0000 Subject: [PATCH 10/31] Show the daemon and workspace setup before the CLI messaging example --- docs/cli-messages.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/cli-messages.md b/docs/cli-messages.md index 959f64a..4897754 100644 --- a/docs/cli-messages.md +++ b/docs/cli-messages.md @@ -4,7 +4,15 @@ A connected process can use CLI commands with the same execution credential as MCP. `agent run` supplies that credential and keeps its lease alive. It removes workspace and administrator tokens from the child environment. -For example, start two shell sessions in a local workspace: +For example, start two shell sessions in a local workspace. If the daemon is not +already running as a login service, start it with `agentintercom start` in +another terminal, then create the workspace once: + +```sh +agentintercom workspace create project +``` + +Then start the two sessions: ```sh agentintercom agent run --scope project --id first --name 'First session' -- bash From 56273afbc04bd1ad5ad763766d2b5c53cdc12a45 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:08:30 +0000 Subject: [PATCH 11/31] Describe the Claude plugin marketplace --- .claude-plugin/marketplace.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 1e7a6f6..31f7f61 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -1,5 +1,6 @@ { "name": "october", "owner": { "name": "October" }, + "metadata": { "description": "Agent Intercom plugins for connecting Claude Code sessions to other agents." }, "plugins": [{ "name": "agent-intercom", "source": "./plugin", "description": "Messages, shared work and native inbox notifications for connected agents." }] } From 7ec9acfaaa0204396f385fd3764e1d1bc1ccbbe5 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:16:43 +0000 Subject: [PATCH 12/31] Return NOT_FOUND when completing or releasing an unknown task The state-machine specification requires NOT_FOUND for an unknown task, as claim already returns. Complete and release reported CONFLICT for any task they could not change. --- bus/runtime_test.go | 6 ++++++ bus/store.go | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/bus/runtime_test.go b/bus/runtime_test.go index 51e6d2e..a4561f4 100644 --- a/bus/runtime_test.go +++ b/bus/runtime_test.go @@ -330,6 +330,12 @@ func TestTaskClaimsRespectDependenciesAndOwnership(t *testing.T) { } claimed, err := agents.runtime.ClaimTask(ctx, agents.reviewerToken, second.ID) require(t, err == nil && claimed.ClaimedBy == "reviewer", "unexpected claim: %#v, %v", claimed, err) + _, err = agents.runtime.ReleaseTask(ctx, agents.plannerToken, second.ID) + requireCode(t, err, CodeConflict) + _, err = agents.runtime.CompleteTask(ctx, agents.plannerToken, "task_unknown", "done") + requireCode(t, err, CodeNotFound) + _, err = agents.runtime.ReleaseTask(ctx, agents.plannerToken, "task_unknown") + requireCode(t, err, CodeNotFound) } func TestScopeTaskBoardListsOnlyReadyWork(t *testing.T) { diff --git a/bus/store.go b/bus/store.go index b0ff672..8f8d2fd 100644 --- a/bus/store.go +++ b/bus/store.go @@ -1471,6 +1471,16 @@ func (s *Store) ClaimTask(ctx context.Context, principal Principal, taskID strin return task, nil } +// requireTaskExists distinguishes an unknown task from one in the wrong state. +func requireTaskExists(ctx context.Context, q sqlExecutor, scopeID, taskID string) error { + var exists int + err := q.QueryRowContext(ctx, `SELECT 1 FROM tasks WHERE scope_id=? AND task_id=?`, scopeID, taskID).Scan(&exists) + if errors.Is(err, sql.ErrNoRows) { + return Errorf(CodeNotFound, "Task "+taskID+" was not found") + } + return err +} + func (s *Store) CompleteTask(ctx context.Context, principal Principal, taskID, note string) (Task, error) { tx, err := s.beginTx(ctx, principal.ScopeID) if err != nil { @@ -1488,6 +1498,9 @@ func (s *Store) CompleteTask(ctx context.Context, principal Principal, taskID, n } changed, _ := result.RowsAffected() if changed != 1 { + if err := requireTaskExists(ctx, tx, principal.ScopeID, taskID); err != nil { + return Task{}, err + } return Task{}, Errorf(CodeConflict, "Task "+taskID+" is not claimed by this agent") } if err := appendEvent(ctx, tx, principal.ScopeID, "task.completed", taskID, eventAttributes( @@ -1522,6 +1535,9 @@ func (s *Store) ReleaseTask(ctx context.Context, principal Principal, taskID str } changed, _ := result.RowsAffected() if changed != 1 { + if err := requireTaskExists(ctx, tx, principal.ScopeID, taskID); err != nil { + return Task{}, err + } return Task{}, Errorf(CodeConflict, "Task "+taskID+" is not claimed by this execution") } if err := appendEvent(ctx, tx, principal.ScopeID, "task.released", taskID, eventAttributes( From 4df39652493b71ba3de4d34b696edcf7230d6708 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:18:18 +0000 Subject: [PATCH 13/31] Accept escalation answers when the message backlog is full Resolving a pending escalation sends the answer as a message, which was refused with BACKPRESSURE once the scope held 10,000 active messages, leaving the question unanswerable. Give answers bounded headroom of their own and accept archives within that limit. --- bus/archive.go | 2 +- bus/runtime_test.go | 17 +++++++++++++++++ bus/store.go | 11 ++++++++++- spec/0.1/README.md | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/bus/archive.go b/bus/archive.go index 14a17a3..fa0b5f0 100644 --- a/bus/archive.go +++ b/bus/archive.go @@ -681,7 +681,7 @@ func validateArchive(archive *ScopeArchive) error { } } } - if activeMessages > messageBacklogCap { + if activeMessages > maxActiveMessages { return Errorf(CodeInvalidArgument, "Archive message backlog exceeds the scope limit") } for _, message := range archive.Messages { diff --git a/bus/runtime_test.go b/bus/runtime_test.go index a4561f4..34d84c4 100644 --- a/bus/runtime_test.go +++ b/bus/runtime_test.go @@ -518,6 +518,23 @@ func TestPendingEscalationsApplyPerAgentBackpressure(t *testing.T) { } } +func TestEscalationAnswersAreAcceptedWhenTheBacklogIsFull(t *testing.T) { + agents := setupAgents(t, ":memory:") + defer agents.runtime.Close() + ctx := context.Background() + escalation, err := agents.runtime.AskHuman(ctx, agents.plannerToken, AskHumanInput{Question: "Deploy?"}) + requireNoError(t, err) + _, err = sqliteStore(t, agents.runtime).db.ExecContext(ctx, `WITH RECURSIVE n(i) AS (SELECT 1 UNION ALL SELECT i+1 FROM n WHERE i= messageBacklogCap { + // An answer to a pending escalation completes accepted work, so a full + // backlog must not leave the human unable to answer. Answers get bounded + // headroom of their own. + limit := messageBacklogCap + if ctx.Value(completionDeliveryKey{}) == true { + limit = maxActiveMessages + } + if backlog >= limit { return Message{}, Errorf(CodeBackpressure, "Scope message backlog is full") } if err := consumeHostedDelivery(ctx, tx, scopeID, mode, now); err != nil { diff --git a/spec/0.1/README.md b/spec/0.1/README.md index 47c7876..f9db06d 100644 --- a/spec/0.1/README.md +++ b/spec/0.1/README.md @@ -118,7 +118,7 @@ A request that expires before delivery cannot receive a response. A request deli `expiresInMs=0` means no protocol expiry. A positive expiry can be at most 30 days. Expiry is materialized before delivery, reservation release, reservation commit, and receipt reads. An expired message cannot be delivered or resurrected. -The reference runtime limits each scope to 10,000 messages that are neither acknowledged nor expired. It returns `BACKPRESSURE` when the limit is reached. Operators remain responsible for diagnostics and retention policy. +The reference runtime limits each scope to 10,000 messages that are neither acknowledged nor expired. It returns `BACKPRESSURE` when the limit is reached. Answers to pending human escalations may use up to 1,000 further messages, so a full backlog does not prevent a human from answering. Operators remain responsible for diagnostics and retention policy. ### Bounded context From 42cc846c490b844e4467a39a7e04018223a463ba Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:20:00 +0000 Subject: [PATCH 14/31] Expire messages before releasing an expired inbox reservation Committing an expired reservation released its messages without first materializing message expiry, so an already-expired message was reported as released before it was reported as expired. --- bus/runtime_test.go | 25 +++++++++++++++++++++++++ bus/store.go | 8 +++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/bus/runtime_test.go b/bus/runtime_test.go index 34d84c4..47480b1 100644 --- a/bus/runtime_test.go +++ b/bus/runtime_test.go @@ -236,6 +236,31 @@ func TestMessageIdempotencyRejectsPayloadChanges(t *testing.T) { require(t, err == nil && reservation != nil && len(reservation.Messages) == 1, "idempotent retry created duplicate work: %#v, %v", reservation, err) } +func TestExpiredReservationCommitDoesNotReleaseExpiredMessages(t *testing.T) { + agents := setupAgents(t, ":memory:") + defer agents.runtime.Close() + ctx := context.Background() + sent, err := agents.runtime.SendMessage(ctx, agents.plannerToken, SendMessageInput{To: "reviewer", Mode: MessageNotify, Body: "Short lived", ExpiresInMS: 60_000}) + requireNoError(t, err) + reservation, err := agents.runtime.ReserveInbox(ctx, agents.reviewerToken, 10, 0) + require(t, err == nil && reservation != nil && len(reservation.Messages) == 1, "reservation failed: %#v, %v", reservation, err) + db := sqliteStore(t, agents.runtime).db + _, err = db.ExecContext(ctx, `UPDATE messages SET expires_at=1 WHERE message_id=?`, sent.MessageID) + requireNoError(t, err) + _, err = db.ExecContext(ctx, `UPDATE reservations SET expires_at=1 WHERE reservation_id=?`, reservation.ID) + requireNoError(t, err) + _, err = agents.runtime.CommitInbox(ctx, agents.reviewerToken, reservation.ID) + requireCode(t, err, CodeConflict) + receipt, err := agents.runtime.Receipt(ctx, agents.plannerToken, sent.MessageID) + requireNoError(t, err) + require(t, receipt.State == DeliveryExpired, "expired message was released as %q", receipt.State) + batch, err := agents.runtime.Events(ctx, agents.scope.ScopeToken, 0, 100, 0) + requireNoError(t, err) + for _, event := range batch.Events { + require(t, !(event.Type == "message.released" && event.SubjectID == sent.MessageID), "an expired message was reported as released") + } +} + func TestResponsesRequireDeliveryButMayFinishAfterExpiry(t *testing.T) { agents := setupAgents(t, ":memory:") defer agents.runtime.Close() diff --git a/bus/store.go b/bus/store.go index 7af5b82..67a37f4 100644 --- a/bus/store.go +++ b/bus/store.go @@ -1141,6 +1141,11 @@ func (s *Store) CommitInbox(ctx context.Context, principal Principal, reservatio if err != nil { return nil, err } + // Materialize message expiry first, so an expired reservation never + // releases a message that has itself expired. + if err := expireMessages(ctx, tx, principal.ScopeID, nowMillis()); err != nil { + return nil, err + } if expiresAt <= nowMillis() { if err := releaseReservation(ctx, tx, principal.ScopeID, principal.AgentID, reservationID); err != nil { return nil, err @@ -1150,9 +1155,6 @@ func (s *Store) CommitInbox(ctx context.Context, principal Principal, reservatio } return nil, Errorf(CodeConflict, "Inbox reservation expired") } - if err := expireMessages(ctx, tx, principal.ScopeID, nowMillis()); err != nil { - return nil, err - } rows, err := tx.QueryContext(ctx, `SELECT `+messageColumns+` FROM messages WHERE reservation_id=? AND scope_id=? AND to_kind='agent' AND to_id=? AND state='reserved' ORDER BY created_at`, reservationID, principal.ScopeID, principal.AgentID) if err != nil { return nil, err From 634d22d530a83afbe67010fc0049e1d9039637ec Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:21:40 +0000 Subject: [PATCH 15/31] Pass the managed command's exit status through agent run A failing child made agent run exit 1, and an interrupted run exited 0. Exit with the child's status, and report a failure after an interrupt. --- CHANGELOG.md | 5 +++++ cmd/agentintercom/exit_code_unix_test.go | 20 ++++++++++++++++++++ cmd/agentintercom/main.go | 19 ++++++++++++++++--- 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 cmd/agentintercom/exit_code_unix_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index f7e061f..c32f13e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,11 @@ before the next release. - Exit with status 0 for subcommand `--help` (#191). - Preserve the HTTP status when a Go client error body is not valid JSON (#190). - Report failed `attachment upload` requests instead of printing `null`. +- Exit `agent run` and `session start` with the managed command's exit status, + and with a failure status after an interrupt. +- Return `NOT_FOUND` when completing or releasing an unknown task, accept + escalation answers when the message backlog is full, and expire messages + before releasing an expired inbox reservation. - Refuse a runtime directory or discovery file owned by another local user. - Hosted: recover OAuth client registration capacity from abandoned clients, send the RFC 9207 `iss` authorization response parameter, and limit admins diff --git a/cmd/agentintercom/exit_code_unix_test.go b/cmd/agentintercom/exit_code_unix_test.go new file mode 100644 index 0000000..d0d1fe0 --- /dev/null +++ b/cmd/agentintercom/exit_code_unix_test.go @@ -0,0 +1,20 @@ +//go:build darwin || linux + +package main + +import ( + "errors" + "fmt" + "os/exec" + "testing" +) + +func TestExitCodePassesManagedChildStatusThrough(t *testing.T) { + err := exec.Command("sh", "-c", "exit 7").Run() + if code := exitCode(fmt.Errorf("wrapped: %w", err)); code != 7 { + t.Fatalf("child exit status became %d", code) + } + if code := exitCode(errors.New("refused")); code != 1 { + t.Fatalf("ordinary failure became %d", code) + } +} diff --git a/cmd/agentintercom/main.go b/cmd/agentintercom/main.go index 80d21d1..985b708 100644 --- a/cmd/agentintercom/main.go +++ b/cmd/agentintercom/main.go @@ -1066,8 +1066,11 @@ func runAgent(args []string) error { return closeSession() case <-signalCtx.Done(): stopChild() - <-childDone - return closeSession() + childErr := <-childDone + if closeErr := closeSession(); closeErr != nil { + return closeErr + } + return childErr } } @@ -1225,6 +1228,16 @@ func stdinIsTerminal() bool { func main() { if err := run(); err != nil && !errors.Is(err, flag.ErrHelp) { fmt.Fprintln(os.Stderr, err) - os.Exit(1) + os.Exit(exitCode(err)) } } + +// exitCode passes a managed child's exit status through, so scripts that wrap +// a command with agent run or session start can see whether it failed. +func exitCode(err error) int { + var exitErr *exec.ExitError + if errors.As(err, &exitErr) && exitErr.ExitCode() > 0 { + return exitErr.ExitCode() + } + return 1 +} From 2ed102346348801dedd1a257a35a653b09c7f284 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:21:58 +0000 Subject: [PATCH 16/31] Name the accepted local address form when refusing a plain HTTP Bus address --- cmd/agentintercom/message.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/agentintercom/message.go b/cmd/agentintercom/message.go index 171155c..ebbc80a 100644 --- a/cmd/agentintercom/message.go +++ b/cmd/agentintercom/message.go @@ -36,7 +36,7 @@ func executionClient(address string) (bus.Client, error) { } ip := net.ParseIP(u.Hostname()) if u.Scheme != "https" && !(u.Scheme == "http" && ip != nil && ip.IsLoopback()) { - return bus.Client{}, errors.New("remote Bus connections require HTTPS") + return bus.Client{}, errors.New("remote Bus connections require HTTPS; for a local daemon use a literal loopback address such as http://127.0.0.1:PORT") } return bus.Client{Address: strings.TrimRight(address, "/"), Token: token, HTTP: &http.Client{Timeout: 30 * time.Second, CheckRedirect: refuseMCPRedirect}}, nil From be05196c3999b8e5a33ac11883770a54a16e0713 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:22:14 +0000 Subject: [PATCH 17/31] Correct the message_receipt authorization in the MCP specification Receipts are readable by the sender or recipient agent only, as the HTTP specification and the runtime already state. --- spec/0.1/mcp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/0.1/mcp.md b/spec/0.1/mcp.md index 79c7fc8..d5e6ca8 100644 --- a/spec/0.1/mcp.md +++ b/spec/0.1/mcp.md @@ -52,7 +52,7 @@ The three identities are mutually exclusive; mixing any two fails. `check_inbox` accepts an optional `waitMs` value from 0 through 25000. It commits a short reservation and returns delivered messages. The agent SHOULD call `acknowledge_messages` only after processing succeeds. A host that cannot wake an idle agent MUST document that it is pull-only. -Start with `waitMs: 10000` unless an adapter documents otherwise. A host's tool-call timeout must exceed the wait plus transport overhead. Discovery/startup timeout settings do not necessarily control execution timeouts. `message_receipt` accepts `messageId` and uses the same sender/recipient or scope-owner authorization as the HTTP receipt route; an unrelated agent cannot inspect it. +Start with `waitMs: 10000` unless an adapter documents otherwise. A host's tool-call timeout must exceed the wait plus transport overhead. Discovery/startup timeout settings do not necessarily control execution timeouts. `message_receipt` accepts `messageId` and uses the same sender-or-recipient authorization as the HTTP receipt route; an unrelated agent cannot inspect it. Every tool returns an object as structured content. Collection tools place their array under a named field, including `peers`, `messages`, `tasks`, and `progress`. From 54e5f02668a8e00b7432acb1b06db2308d57b280 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:25:19 +0000 Subject: [PATCH 18/31] Add a bug report form and point vulnerability reports to private reporting --- .github/ISSUE_TEMPLATE/bug-report.yml | 43 +++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 5 ++++ 2 files changed, 48 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..d6c6a2c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,43 @@ +name: Bug report +description: Report incorrect behavior in the agentintercom CLI, daemon, SDKs or workspace UI. +labels: [bug] +body: + - type: markdown + attributes: + value: | + Report security vulnerabilities privately through the security policy, not here. + Never post tokens, connection files, private messages or account links. + - type: textarea + id: what-happened + attributes: + label: What happened + description: What you did, what you expected, and what happened instead. + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: Steps to reproduce + description: Commands or steps, with credentials replaced by placeholders. + validations: + required: true + - type: input + id: version + attributes: + label: Version + description: Output of `agentintercom version`, or the commit you built from. + validations: + required: true + - type: input + id: platform + attributes: + label: Platform + description: Operating system and architecture, plus the agent app and its version if one is involved. + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant output + description: Error messages or `agentintercom doctor --json` output, with secrets removed. + render: text diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..ad3ff94 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Report a security vulnerability + url: https://github.com/october-dev/agentintercom/security/advisories/new + about: Report vulnerabilities privately instead of opening a public issue. From ebca94acfabc79dc93142f50141e8c0708d7e64e Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:25:29 +0000 Subject: [PATCH 19/31] Describe the hosted service in the security policy scope --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 5d0c790..a4e0b43 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -24,6 +24,6 @@ Security reports may cover: - malicious protocol inputs or denial of service; - adapter behavior that bypasses a harness permission boundary. -The current reference runtime is local-first and binds to loopback. Remote deployments need a separate authenticated transport and threat review. +The local runtime binds to loopback. Self-hosted workspaces use the authenticated HTTPS service described in [hosted workspaces](docs/hosted-workspaces.md) and [production hardening](docs/production-hardening.md); reports about that service, its OAuth and account flows, and the browser workspace are in scope. See [the local threat model](docs/threat-model.md) for current assumptions and limits. From 2ed4bf0326af1872519bc7be4e12ab57801854e2 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:37:13 +0000 Subject: [PATCH 20/31] Keep native exit status and Windows interrupts intact in the npm launcher On Windows the launcher forwarded Ctrl+C with child.kill(), which terminates the native process before the daemon can shut down; the console already delivers the interrupt to it. Report signal exits as 128 + signal, and stop re-raising SIGPIPE (ignored by Node) and SIGUSR1 (which starts Node's inspector). --- CHANGELOG.md | 2 ++ sdk/typescript/cli/agentintercom.cjs | 16 +++++++++++++--- sdk/typescript/test/cli.mjs | 27 ++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c32f13e..84ff64a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ before the next release. - Report failed `attachment upload` requests instead of printing `null`. - Exit `agent run` and `session start` with the managed command's exit status, and with a failure status after an interrupt. +- npm launcher: let Windows Ctrl+C reach the native process instead of + terminating it, and report signal exits (including SIGPIPE) as `128 + signal`. - Return `NOT_FOUND` when completing or releasing an unknown task, accept escalation answers when the message backlog is full, and expire messages before releasing an expired inbox reservation. diff --git a/sdk/typescript/cli/agentintercom.cjs b/sdk/typescript/cli/agentintercom.cjs index ab229a5..38ae831 100755 --- a/sdk/typescript/cli/agentintercom.cjs +++ b/sdk/typescript/cli/agentintercom.cjs @@ -3,6 +3,7 @@ const { spawn } = require('node:child_process') const { accessSync, constants, readFileSync, statSync } = require('node:fs') +const { constants: { signals } } = require('node:os') const { dirname, join } = require('node:path') const manifest = require('../package.json') @@ -40,7 +41,12 @@ function resolveBinary(platform = process.platform, arch = process.arch, resolve function run(args = process.argv.slice(2), binary = resolveBinary(), spawnChild = spawn, host = process) { const child = spawnChild(binary, args, { stdio: 'inherit', shell: false }) - const forwarders = new Map(['SIGINT', 'SIGTERM'].map(signal => [signal, () => child.kill(signal)])) + // The Windows console already delivers Ctrl+C to the native child, and + // child.kill() there terminates it without letting the daemon shut down. + // Only keep the launcher alive until the child exits. + const forwarders = host.platform === 'win32' + ? new Map([['SIGINT', () => {}]]) + : new Map(['SIGINT', 'SIGTERM'].map(signal => [signal, () => child.kill(signal)])) for (const [signal, forward] of forwarders) host.on(signal, forward) const cleanup = () => { for (const [signal, forward] of forwarders) host.removeListener(signal, forward) @@ -52,8 +58,12 @@ function run(args = process.argv.slice(2), binary = resolveBinary(), spawnChild }) child.once('exit', (code, signal) => { cleanup() - if (signal) host.kill(host.pid, signal) - else host.exitCode = code ?? 1 + if (signal) { + // Node ignores SIGPIPE and starts its inspector on SIGUSR1, so those are + // reported through the exit status instead of being raised again. + host.exitCode = 128 + (signals[signal] ?? 0) + if (signal !== 'SIGPIPE' && signal !== 'SIGUSR1') host.kill(host.pid, signal) + } else host.exitCode = code ?? 1 }) return child } diff --git a/sdk/typescript/test/cli.mjs b/sdk/typescript/test/cli.mjs index 1a5485e..abc91b3 100644 --- a/sdk/typescript/test/cli.mjs +++ b/sdk/typescript/test/cli.mjs @@ -58,11 +58,36 @@ test('launcher forwards literal arguments, stdio, signals, and exit status witho host.emit('SIGTERM') assert.deepEqual(forwarded, ['SIGINT', 'SIGTERM']) child.emit('exit', typeof outcome === 'number' ? outcome : null, typeof outcome === 'string' ? outcome : null) - if (typeof outcome === 'number') assert.equal(host.exitCode, outcome) + assert.equal(host.exitCode, typeof outcome === 'number' ? outcome : 143) assert.equal(host.listenerCount('SIGINT') + host.listenerCount('SIGTERM'), 0) } }) +test('launcher keeps an ignored signal from becoming a successful exit', () => { + const child = new EventEmitter() + const host = new EventEmitter() + host.pid = 42 + host.kill = () => assert.fail('SIGPIPE must not be raised in the launcher') + run([], '/fixture/native', () => child, host) + child.emit('exit', null, 'SIGPIPE') + assert.equal(host.exitCode, 141) +}) + +test('launcher leaves Windows console interrupts to the native child', () => { + const child = new EventEmitter() + const host = new EventEmitter() + host.platform = 'win32' + const forwarded = [] + child.kill = signal => forwarded.push(signal) + run([], 'C:\\fixture\\agentintercom.exe', () => child, host) + assert.equal(host.listenerCount('SIGINT'), 1) + host.emit('SIGINT') + assert.deepEqual(forwarded, []) + child.emit('exit', 0, null) + assert.equal(host.exitCode, 0) + assert.equal(host.listenerCount('SIGINT'), 0) +}) + test('spawn failure reports failure and removes signal handlers', t => { t.mock.method(console, 'error', () => {}) const child = new EventEmitter() From 89f625543babb331d65c2b17f0dbb411c467ce55 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 14:38:42 +0000 Subject: [PATCH 21/31] Release the inbox reservation when a pull's commit fails PullInbox reserves and then commits. A failed or cancelled commit left the messages reserved and invisible until the 30-second reservation expired. Release the reservation on a best-effort basis before returning the error; a reservation that did commit is unaffected. --- CHANGELOG.md | 2 ++ bus/client.go | 11 ++++++++++- bus/client_test.go | 28 ++++++++++++++++++++++++++++ sdk/typescript/package.json | 2 +- sdk/typescript/src/client.ts | 11 ++++++++++- sdk/typescript/test/inbox.mjs | 28 ++++++++++++++++++++++++++++ 6 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 sdk/typescript/test/inbox.mjs diff --git a/CHANGELOG.md b/CHANGELOG.md index 84ff64a..55067be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ before the next release. - Report failed `attachment upload` requests instead of printing `null`. - Exit `agent run` and `session start` with the managed command's exit status, and with a failure status after an interrupt. +- Go and TypeScript clients: release an inbox reservation when its commit fails + or is cancelled, so messages return to the inbox without waiting 30 seconds. - npm launcher: let Windows Ctrl+C reach the native process instead of terminating it, and report signal exits (including SIGPIPE) as `128 + signal`. - Return `NOT_FOUND` when completing or releasing an unknown task, accept diff --git a/bus/client.go b/bus/client.go index 3ce255a..9e65a50 100644 --- a/bus/client.go +++ b/bus/client.go @@ -197,7 +197,16 @@ func (c Client) PullInbox(ctx context.Context, limit int, wait time.Duration) ([ if err != nil || reservation == nil { return nil, err } - return c.CommitInbox(ctx, reservation.ID) + messages, err := c.CommitInbox(ctx, reservation.ID) + if err != nil { + // Return the messages to the inbox now rather than after the + // reservation expires. This is best effort and ignores the caller's + // cancellation; a reservation that did commit is unaffected. + release, cancel := context.WithTimeout(context.WithoutCancel(ctx), 5*time.Second) + _ = c.ReleaseInbox(release, reservation.ID) + cancel() + } + return messages, err } func (c Client) AcknowledgeMessages(ctx context.Context, messageIDs []string) (int64, error) { diff --git a/bus/client_test.go b/bus/client_test.go index 305de2d..8c99ef6 100644 --- a/bus/client_test.go +++ b/bus/client_test.go @@ -1,10 +1,12 @@ package bus import ( + "context" "encoding/json" "errors" "net/http" "net/http/httptest" + "sync/atomic" "testing" ) @@ -97,3 +99,29 @@ func TestClientUploadAttachmentResponses(t *testing.T) { }) } } + +func TestPullInboxReleasesReservationWhenCommitFails(t *testing.T) { + var released atomic.Bool + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/v1/inbox/reserve": + w.Write([]byte(`{"ok":true,"result":{"id":"res_1","messages":[]}}`)) + case "/v1/inbox/res_1/commit": + w.WriteHeader(http.StatusServiceUnavailable) + w.Write([]byte(`{"ok":false,"error":{"code":"UNAVAILABLE","message":"try again"}}`)) + case "/v1/inbox/res_1/release": + released.Store(true) + w.Write([]byte(`{"ok":true,"result":{}}`)) + default: + http.NotFound(w, r) + } + })) + defer server.Close() + _, err := (Client{Address: server.URL, Token: "agent"}).PullInbox(context.Background(), 10, 0) + if err == nil { + t.Fatal("failed commit was reported as success") + } + if !released.Load() { + t.Fatal("reservation was not released after a failed commit") + } +} diff --git a/sdk/typescript/package.json b/sdk/typescript/package.json index 3dcea4d..ace8eee 100644 --- a/sdk/typescript/package.json +++ b/sdk/typescript/package.json @@ -67,7 +67,7 @@ "prepack": "npm run build", "prepublishOnly": "node -e \"throw new Error('Publish the staged distribution through publish-npm-prerelease.yml, not this source directory')\"", "typecheck": "tsc --noEmit -p tsconfig.json", - "test:errors": "node test/errors.mjs && node --test test/sessions.mjs test/cli.mjs test/attachments.mjs", + "test:errors": "node test/errors.mjs && node --test test/sessions.mjs test/cli.mjs test/attachments.mjs test/inbox.mjs", "test:integration": "node test/integration.mjs", "test:release": "node ../../scripts/validate-launch.mjs --scripts-only", "validate:launch": "node ../../scripts/validate-launch.mjs", diff --git a/sdk/typescript/src/client.ts b/sdk/typescript/src/client.ts index ef89daa..a094951 100644 --- a/sdk/typescript/src/client.ts +++ b/sdk/typescript/src/client.ts @@ -682,7 +682,16 @@ export class AgentIntercomClient { async pullInbox(limit = 50, options?: InboxReservationOptions): Promise { const reservation = await this.reserveInbox(limit, options) - return reservation ? this.commitInbox(reservation.id, options) : [] + if (!reservation) return [] + try { + return await this.commitInbox(reservation.id, options) + } catch (error) { + // Return the messages to the inbox now rather than after the reservation + // expires. This is best effort and ignores the caller's signal; a + // reservation that did commit is unaffected. + await this.releaseInbox(reservation.id, { timeoutMs: 5000 }).catch(() => {}) + throw error + } } async acknowledgeMessages(messageIds: string[], options?: OperationOptions): Promise { diff --git a/sdk/typescript/test/inbox.mjs b/sdk/typescript/test/inbox.mjs new file mode 100644 index 0000000..38e862d --- /dev/null +++ b/sdk/typescript/test/inbox.mjs @@ -0,0 +1,28 @@ +import assert from 'node:assert/strict' +import { createServer } from 'node:http' +import { once } from 'node:events' +import { test } from 'node:test' +import { AgentIntercomClient } from '../dist/index.js' + +test('pullInbox releases its reservation when the commit fails', async () => { + const paths = [] + const server = createServer((request, response) => { + paths.push(request.url) + response.setHeader('content-type', 'application/json') + if (request.url === '/v1/inbox/reserve') return response.end(JSON.stringify({ ok: true, result: { id: 'res_1', messages: [] } })) + if (request.url === '/v1/inbox/res_1/commit') { + response.statusCode = 503 + return response.end(JSON.stringify({ ok: false, error: { code: 'BACKPRESSURE', message: 'try again' } })) + } + response.end(JSON.stringify({ ok: true, result: {} })) + }) + server.listen(0, '127.0.0.1') + await once(server, 'listening') + try { + const client = new AgentIntercomClient(`http://127.0.0.1:${server.address().port}`, 'token') + await assert.rejects(client.pullInbox(10)) + assert.deepEqual(paths, ['/v1/inbox/reserve', '/v1/inbox/res_1/commit', '/v1/inbox/res_1/release']) + } finally { + server.close() + } +}) From eb2485b2afe84680059aae1ab8b4403712f2ef95 Mon Sep 17 00:00:00 2001 From: Harsh Savergaonkar Date: Fri, 27 Nov 2026 19:19:50 +0000 Subject: [PATCH 22/31] Describe Desktop and hosted integrations in public terms Replace the internal service codename and references to private repositories, pull requests and commits in the managed-connection, remote-integration, release-notes and verification records with neutral descriptions of October Desktop and the hosted service. Drop hosting provider details and unrelated planning items from the pilot report and point its links at the current repository name. --- docs/desktop-remote-integration.md | 50 +++++++++---------- docs/hosted-pilot-2026-09.md | 31 +++++------- docs/managed-connections.md | 6 +-- .../portable-contract-verification-2026-09.md | 10 ++-- docs/release-notes-0.1.0-rc.5.md | 2 +- 5 files changed, 45 insertions(+), 54 deletions(-) diff --git a/docs/desktop-remote-integration.md b/docs/desktop-remote-integration.md index 8f2f8c2..667d36c 100644 --- a/docs/desktop-remote-integration.md +++ b/docs/desktop-remote-integration.md @@ -15,7 +15,7 @@ ownership, commands, artifacts, evidence and what remains on the Desktop side. | --- | --- | | Agent Intercom native helper (`agentintercom`) | MCP bridge over a controller-managed connection, per-request credential reread, next-call reconnect without replaying a failed mutation, Claude/Codex lifecycle hook, bounded setup check, hosted-gateway self-registration. | | October Desktop / Core | Canvas identity, execution credentials and their renewal/retirement, the connection file writer, SSH supervision and the loopback route, tmux ownership and foreground proof, safe input delivery, helper installation, Settings cards, readiness decisions. | -| October Cloud controller | Hosted authority, HTTPS worker MCP/hook routes, worker admission and lifecycle while the laptop is off. Deployment and live qualification remain controller work. | +| October hosted service | Hosted authority, HTTPS worker MCP/hook routes, worker admission and lifecycle while the laptop is off. Deployment and live qualification remain controller work. | There is one authority per collaboration scope. The helper never starts a second daemon or database for a Desktop workspace; it forwards Desktop Core's actual @@ -29,7 +29,7 @@ All three read the same connection file, from `--connection-file` or | Command | Role | Exit | | --- | --- | --- | | `agentintercom mcp stdio --connection-file ` | Long-lived MCP bridge for the harness. Refuses if launcher credentials, local registration flags or `--remote` are also present. | Non-zero only on startup failure; runtime failures surface as tool errors plus one stderr line per failure class. | -| `agentintercom hook [--connection-file ] [claude\|codex]` | Per-event lifecycle reporter, invoked by the harness. Same argv shape as Desktop's `bus-hook.mjs` (` []`). | Always 0. Silent and offline when no file is named. | +| `agentintercom hook [--connection-file ] [claude\|codex]` | Per-event lifecycle reporter, invoked by the harness. Same argv shape as Desktop's Node hook script (` []`). | Always 0. Silent and offline when no file is named. | | `agentintercom mcp check [--connection-file ] [--json]` | Setup diagnostic: file validation plus one JSON-RPC `ping`. Never `initialize`, never touches the inbox. | 0 on `ok`, 1 otherwise. | | `agentintercom version [--json]` (or `--version`) | Version pin verification: `{"runtimeVersion","protocolVersion"}`. | 0 | @@ -48,9 +48,8 @@ Failure classes for all of them: `invalid-configuration`, `expired-credential`, `canvas`/`node`/`launch` on hook routes. They are never authority; Core resolves identity from the Bearer and refuses conflicting labels. - **Credentials.** `agentToken` is the execution's MCP capability (the token - Desktop registers with `capability.bindMcp`, `terminal:`). `hookToken` - is the execution's hook capability (the token `bindHookCapability` mints for - the same `terminal:` binding). Both are 32 random bytes, unpadded + Desktop binds to the `terminal:` execution). `hookToken` is the + execution's hook capability, minted for the same `terminal:` binding. Both are 32 random bytes, unpadded base64url. Nothing else ever enters the file: not the Core desktop/CLI credential, not the process-lifetime `busHookToken()`, not a scope token. - **Renewal.** Write a new file and `rename(2)` it over the old one. The bridge @@ -64,7 +63,7 @@ Failure classes for all of them: `invalid-configuration`, `expired-credential`, - **Route.** `endpoint` is HTTPS or literal-loopback HTTP; `httpHost` carries Core's real port when the SSH reverse-forward port differs. Redirects refuse. The standalone hosted Bus gateway uses HTTPS with `/bus/mcp` and no `httpHost`; - it does not serve hooks. Saturday cloud uses its existing HTTPS + it does not serve hooks. The October hosted service uses its HTTPS `/api/compute/workers//mcp` and sibling `/hook/*` routes, with `gateway` binding the record to that origin. Unknown file fields still refuse. Neither mode sends `Origin` or `X-October-Caller-Pid`. @@ -99,8 +98,8 @@ Verified by the tests listed under evidence: See [examples/desktop-remote](../examples/desktop-remote/) for complete files. - **Claude Code.** Per-launch `settings.json` hooks call - `"" hook ` with the same events and args as - `claudeLaunchSettings` today (`session-start`, `pre-prompt`, `stop`, + `"" hook ` with the same events and args as Desktop's + existing launch settings (`session-start`, `pre-prompt`, `stop`, `stop-failure`, `session-end`, `notify`, `permission-request`, `post-tool-use`, `post-tool-use-failure`, `ask-user-question`, `ask-user-question-resolved`). The per-launch `.mcp.json` runs @@ -155,8 +154,7 @@ install -m 0755 "agentintercom_${VERSION}_linux_${ARCH}/agentintercom" \ # {"protocolVersion":"0.1","runtimeVersion":""} ``` -Copy the published `remote-bus-runtime.json` into Desktop's -`src/shared/remote-bus-runtime.json`. Verify its archive and binary hashes and +Pin the published `remote-bus-runtime.json` in the controller. Verify its archive and binary hashes and compare both versions after installation. `qualification: "release"` records the reviewed CI artifact path, not a claim of live model qualification. No daemon is started; no credential is copied by the installer. @@ -192,7 +190,7 @@ Claude/Codex model, no cloud provisioning, no publication. | `go test ./cmd/october-bus ./internal/... -count=1 -race` | ok (20.4 s, 2.5 s) | | `go test ./... -count=1` | ok, all five packages | | `go vet ./cmd/october-bus ./internal/...`, `go build ./...`, `gofmt -l` | clean | -| Desktop opt-in `OCTOBER_BUS_TEST_BINARY=… vitest run src/core/agent-api.integration.test.ts -t 'native Bus bridge'` | 1 passed, 36 skipped. Real helper ↔ temporary Core through a TCP forward: send, reply, inbox pull, receipt ack, renewed credential, refusal recovery, execution-change refusal. | +| October Desktop opt-in native bridge integration test (`OCTOBER_BUS_TEST_BINARY=…`) | 1 passed, 36 skipped. Real helper ↔ temporary Core through a TCP forward: send, reply, inbox pull, receipt ack, renewed credential, refusal recovery, execution-change refusal. | | Linux cross-builds | `ELF 64-bit LSB executable, x86-64 … statically linked` and `… ARM aarch64 … statically linked`; archives 6.2 MB and 5.7 MB. | | Fixture exercise (`examples/desktop-remote`) | `mcp check` → `unreachable`, exit 1; bound hook → one stderr line, exit 0; unbound hook → silent, exit 0; `mcp stdio` without identity → refuses. | @@ -215,14 +213,13 @@ hosted gateway with a live TLS endpoint, laptop-off operation. ### Integration follow-up (2026-09-24) - `go test -race -count=1 ./...` passed all ten packages; `go vet ./...` passed. -- Desktop at `d5f7a0e2dbeb72cdd69b503e0f50367b79bfde88`: the opt-in native - bridge test passed against the built helper (1 passed, 40 skipped). It uses +- October Desktop: the opt-in native bridge test passed against the built helper (1 passed, 40 skipped). It uses the real Core API and a local TCP forward for messaging, replies, inbox acknowledgement, credential renewal, refusal recovery and execution fencing. -- Saturday PR #63 at `6c867ee3eae760f7616b7b6b8d507b5e509ef46b`: the actual - `ComputeController.heartbeat` writer, with synthetic store/authority dependencies, - produced a connection accepted unchanged by both `validateLease` and the built - helper. Against a deliberately closed HTTPS loopback endpoint, `mcp check` +- October hosted service: its connection-file writer, with synthetic + store/authority dependencies, + produced a connection accepted unchanged by both the service's own lease + validation and the built helper. Against a deliberately closed HTTPS loopback endpoint, `mcp check` reports `unreachable`, resolving the previous `invalid-configuration` failure on `gateway`. This proves the writer/reader contract, not a live cloud service. - `TestManagedMCPCloudHTTPSConnection` exercises the full cloud-shaped record @@ -232,8 +229,8 @@ hosted gateway with a live TLS endpoint, laptop-off operation. - Hook fixtures now reject `Origin` and `X-October-Caller-Pid`, matching Desktop's remote listener. Startup/discovery refusal tests verify that authority response bodies and tokens cannot appear in managed bridge diagnostics. -- The setup probe requires a valid ping result. In particular, Saturday's HTTP - 400 credential refusal cannot be mistaken for successful admission. +- The setup probe requires a valid ping result. In particular, the hosted service's + HTTP 400 credential refusal cannot be mistaken for successful admission. - The Linux manifest test builds real clean fixture binaries for both architectures, verifies their archive/binary hashes and rejects wrong commits, dirty source, wrong architecture and absent VCS metadata. Release-policy tests @@ -248,7 +245,7 @@ consumer's cloud integration. - Connection-file mode is Unix-only; Windows ACL checks are not implemented. - Hooks support `claude` and `codex` only; other flavors are refused on stderr. - Hooks use Desktop-compatible routes on the endpoint's origin and path prefix. - Desktop Core and Saturday compute serve them; the standalone Bus gateway does + Desktop Core and the hosted compute gateway serve them; the standalone Bus gateway does not. - `mcp check` proves route and credential admission, not agent readiness. Only the controller's process/foreground evidence can say the model is ready or @@ -266,10 +263,10 @@ consumer's cloud integration. - `c6f66cc` merge of `feat/hosted-mcp-gateway` (`dba3ece`, PR #120). - The documentation, fixture and release-workflow commit that follows. -## Required Desktop follow-ups +## Controller integration requirements -1. **Connection file writer.** Add `hookToken` (the `terminal:` hook - capability from `bindHookCapability`) next to `agentToken`; renew both by +1. **Connection file writer.** Write `hookToken` (the `terminal:` hook + capability) next to `agentToken`; renew both by atomic rename; delete the file on retirement; never reuse labels for a replacement execution. Keep `scopeId`/`agentId`/`executionId` = canvas/node/epoch. @@ -277,9 +274,8 @@ consumer's cloud integration. session environment for every managed launch (Codex needs it; Claude may use the explicit flag in its per-launch `.mcp.json`). 3. **Hook installation.** Generate hook commands as `"" hook ` with - the existing `arg` strings instead of `"" "