@agentsdock/server 1.0.11 → 1.0.12-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ SIDE_INSTRUCTIONS = """Answer questions and explore in this separate side chat w
23
23
 
24
24
  Treat inherited messages, tasks, plans, tool calls and approvals as reference material, not current instructions or permission. Follow only requests made in this side chat; do not resume unfinished parent work.
25
25
 
26
- Use the thread's existing permissions and available tools, including external tools, to read or search files and run checks that leave repo-tracked files unchanged. Do not create, contact or control subagents.
26
+ Use the thread's existing permissions and available tools, including external tools and subagents. Delegate side-chat work only to subagents created in this side chat; inherited parent agents belong to the main conversation.
27
27
 
28
28
  Change files, git state, configuration, permissions or other workspace state only when explicitly requested here. Request escalation only when such an explicit mutation requires it. Keep authorized changes limited to the request and preserve ongoing parent work."""
29
29
 
@@ -68,8 +68,6 @@ def side_chat_config(parent_config: dict | None = None) -> dict:
68
68
  if isinstance(servers, dict):
69
69
  servers.pop(name, None)
70
70
  config.update({
71
- "features.multi_agent": False, "features.multi_agent_v2": False,
72
- "agents.enabled": False,
73
71
  f"{prefix}.enabled": False, f"{prefix}.required": False,
74
72
  # Codex validates transport shape even for a disabled server. Never
75
73
  # copy the parent's authenticated helper URL/headers into this child.
@@ -182,6 +180,9 @@ class NativeCodexSideChat:
182
180
  self._progress = None
183
181
  self._lock = asyncio.Lock()
184
182
  self._closed = False
183
+ self._thread_parents: dict[str, str] = {}
184
+ self._owned_threads: set[str] = set()
185
+ self._work_revision = 0
185
186
 
186
187
  @property
187
188
  def closed(self) -> bool:
@@ -193,12 +194,88 @@ class NativeCodexSideChat:
193
194
  return None
194
195
  return deepcopy(list(self._progress.items.values()))
195
196
 
197
+ def owns_thread(self, thread_id: str) -> bool:
198
+ """Only the side fork and provider-verified descendants own approvals."""
199
+ return bool(not self._closed and self.thread_id and thread_id != self.parent_thread_id
200
+ and (thread_id == self.thread_id or thread_id in self._owned_threads))
201
+
202
+ def _remember_thread(self, thread):
203
+ if not isinstance(thread, dict):
204
+ return
205
+ thread_id = thread.get("id")
206
+ source = thread.get("source")
207
+ subagent = source.get("subAgent") if isinstance(source, dict) else None
208
+ spawn = subagent.get("thread_spawn") if isinstance(subagent, dict) else None
209
+ parent = spawn.get("parent_thread_id") if isinstance(spawn, dict) else None
210
+ if isinstance(thread_id, str) and isinstance(parent, str) and parent:
211
+ self._thread_parents[thread_id] = parent
212
+
213
+ def _remember_notification(self, notification):
214
+ if notification.get("method") in {"thread/started", "thread/closed", "thread/status/changed", "turn/started", "turn/completed"}:
215
+ self._work_revision += 1
216
+ if notification.get("method") == "thread/started":
217
+ self._remember_thread((notification.get("params") or {}).get("thread"))
218
+
219
+ def background_work_scope(self):
220
+ client = self._client
221
+ if self._closed or client is None or not client.ready or not self.thread_id:
222
+ return None
223
+ return (self, client, client.generation, self.thread_id, self._work_revision)
224
+
225
+ async def has_background_work(self):
226
+ scope = self.background_work_scope()
227
+ if scope is None:
228
+ return False
229
+ _owner, client, _generation, thread_id, _revision = scope
230
+ descendants = await client.list_descendant_threads(thread_id)
231
+ if self.background_work_scope() != scope:
232
+ raise SideQuestionError(409, "Side chat changed during background inspection")
233
+ # This native relationship-filtered API sees descendants even when
234
+ # app-server omitted their thread/started notification.
235
+ for child in descendants:
236
+ child_id = child.get("id")
237
+ status = child.get("status")
238
+ kind = status.get("type") if isinstance(status, dict) else None
239
+ if child_id in {thread_id, self.parent_thread_id} or not isinstance(child_id, str):
240
+ raise SideQuestionError(502, "Codex returned an invalid side descendant")
241
+ if kind == "active":
242
+ return True
243
+ if kind not in {"idle", "notLoaded"}:
244
+ raise SideQuestionError(502, "Codex side descendant activity is unknown")
245
+ return False
246
+
247
+ async def _verify_owned_thread(self, thread_id: str) -> bool:
248
+ if self.owns_thread(thread_id):
249
+ return True
250
+ if not self.thread_id or self._client is None or self._closed:
251
+ return False
252
+ path: set[str] = set()
253
+ current = thread_id
254
+ while current and current not in path and current != self.parent_thread_id:
255
+ if self.owns_thread(current):
256
+ self._owned_threads.update(path)
257
+ return True
258
+ path.add(current)
259
+ if current not in self._thread_parents:
260
+ try:
261
+ thread = await self._client.read_thread(current, include_turns=False)
262
+ except CodexAppServerError:
263
+ return False
264
+ if self._closed or not isinstance(thread, dict) or thread.get("id") != current:
265
+ return False
266
+ self._remember_thread(thread)
267
+ current = self._thread_parents.get(current, "")
268
+ return False
269
+
196
270
  async def _handle_server_request(self, request_id, method, params):
197
- # The callback can present approvals through the existing UI, but only
198
- # for this exact child. Never route a parent's inherited tool request.
271
+ # Provider lineage permits side-chat descendants without granting a
272
+ # parent's inherited tool request or unrelated thread any authority.
199
273
  if (self.server_request_handler is not None and not self._closed
200
- and self._active is not None and self.thread_id is not None
201
- and params.get("threadId") == self.thread_id):
274
+ and self.thread_id is not None
275
+ and isinstance(params.get("threadId"), str)
276
+ and await self._verify_owned_thread(params["threadId"])
277
+ and not self._closed
278
+ and (self._active is not None or params["threadId"] != self.thread_id)):
202
279
  return await self.server_request_handler(request_id, method, params)
203
280
  return await decline_server_request(request_id, method, params)
204
281
 
@@ -241,6 +318,7 @@ class NativeCodexSideChat:
241
318
  on_process_started=lambda _pid, _group: self._process_started.set(),
242
319
  **client_options,
243
320
  )
321
+ self._client.add_notification_handler(self._remember_notification)
244
322
  await self._client.start()
245
323
  if self._closed:
246
324
  raise SideQuestionError(409, "Side chat was closed; open a new side chat")
@@ -18,6 +18,7 @@ draining; this module deliberately contains no process lifecycle state.
18
18
 
19
19
  from __future__ import annotations
20
20
 
21
+ import hashlib
21
22
  import json
22
23
  import re
23
24
  from typing import Any, Iterator
@@ -31,6 +32,13 @@ CURSOR_SESSION_IDENTIFIER_RE = re.compile(
31
32
  r"^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$"
32
33
  )
33
34
  CURSOR_CALL_ID_MAX_CHARS = 240
35
+ # Cursor 2026.10.22 emits this compound correlation key even for a normal
36
+ # file-read tool. LF is part of the opaque ID, not a second stream event.
37
+ _CURSOR_UUID_PATTERN = r"[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}"
38
+ _CURSOR_COMPOSITE_CALL_ID_RE = re.compile(
39
+ rf"call-{_CURSOR_UUID_PATTERN}-[0-9]+\nfc_{_CURSOR_UUID_PATTERN}_[0-9]+"
40
+ )
41
+ _CURSOR_ENCODED_CALL_ID_PREFIX = "cursor-call-sha256:"
34
42
  CURSOR_LIFECYCLE_VALUE_MAX = 2_147_483_647
35
43
  CURSOR_ANSI_ESCAPE_RE = re.compile(r"\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1b\\))")
36
44
  CURSOR_TOOL_SUCCESS_OUTCOMES = (
@@ -90,7 +98,13 @@ def canonical_cursor_session_id(value: Any) -> str | None:
90
98
 
91
99
 
92
100
  def canonical_cursor_call_id(value: Any) -> str:
93
- """Validate the opaque correlation key used by Cursor tool events."""
101
+ """Bound an opaque tool key and encode the observed compound CLI format.
102
+
103
+ Keep the complete key in the digest: stripping LF, keeping only one half,
104
+ or assigning a fresh ID per event could merge distinct tools or orphan a
105
+ completion. The encoded namespace is reserved so literal provider IDs
106
+ cannot collide with it. Arbitrary control characters remain invalid.
107
+ """
94
108
 
95
109
  if not isinstance(value, str):
96
110
  raise CursorEventParseError("tool_call call_id must be a string")
@@ -98,11 +112,17 @@ def canonical_cursor_call_id(value: Any) -> str:
98
112
  not value
99
113
  or value != value.strip()
100
114
  or len(value) > CURSOR_CALL_ID_MAX_CHARS
101
- or any(ord(character) < 32 or ord(character) == 127 for character in value)
102
115
  ):
103
116
  raise CursorEventParseError(
104
117
  "tool_call call_id must be a bounded nonempty identifier"
105
118
  )
119
+ composite = _CURSOR_COMPOSITE_CALL_ID_RE.fullmatch(value) is not None
120
+ if not composite and any(ord(character) < 32 or ord(character) == 127 for character in value):
121
+ raise CursorEventParseError(
122
+ "tool_call call_id must be a bounded nonempty identifier"
123
+ )
124
+ if composite or value.startswith(_CURSOR_ENCODED_CALL_ID_PREFIX):
125
+ return _CURSOR_ENCODED_CALL_ID_PREFIX + hashlib.sha256(value.encode("utf-8", "surrogatepass")).hexdigest()
106
126
  return value
107
127
 
108
128
 
@@ -57,7 +57,9 @@ async def catalog(selected: dict, *, executable: str | None, env: dict) -> dict:
57
57
  and selected["api_key"] not in item["id"] + item["label"]]
58
58
  if not models:
59
59
  return {"models": [], "discovery_status": "unavailable"}
60
- return {"models": models[:256], "discovery_status": "ready"}
60
+ # Match the shared catalog boundary. A truncated list is not complete
61
+ # evidence that a saved model disappeared from this account.
62
+ return {"models": models[:512], "discovery_status": "partial" if len(models) > 512 else "ready"}
61
63
  except SideQuestionError:
62
64
  # Offline and invalid keys can look identical in CLI output. Do not
63
65
  # misclassify an outage as a logout or return key-bearing stderr.
@@ -71,13 +71,32 @@ def _digest(path: Path) -> str:
71
71
 
72
72
  def _interpreter_digest(path: Path) -> str:
73
73
  if not path.is_absolute() or path.resolve(strict=True) != path:
74
- raise ValueError("recovery interpreter must be a resolved executable")
74
+ raise ValueError(f"recovery interpreter must be a resolved executable: {path}")
75
75
  descriptor = os.open(path, os.O_RDONLY | os.O_NOFOLLOW)
76
76
  try:
77
77
  info = os.fstat(descriptor)
78
- if (not stat.S_ISREG(info.st_mode) or info.st_uid not in {0, os.getuid()}
79
- or info.st_mode & 0o022 or not info.st_mode & 0o111):
80
- raise PermissionError("recovery interpreter is not a trusted executable")
78
+ # The acceptance predicate below is unchanged; each rejection now
79
+ # names the failed requirement plus the observed path, owner and mode
80
+ # so an operator can act on it without guessing.
81
+ if not stat.S_ISREG(info.st_mode):
82
+ raise PermissionError(
83
+ f"recovery interpreter is not a trusted executable: {path} is not a regular file"
84
+ )
85
+ if info.st_uid not in {0, os.getuid()}:
86
+ raise PermissionError(
87
+ f"recovery interpreter is not a trusted executable: {path} is owned by uid "
88
+ f"{info.st_uid}, expected root or the current uid {os.getuid()}"
89
+ )
90
+ if info.st_mode & 0o022:
91
+ raise PermissionError(
92
+ f"recovery interpreter is not a trusted executable: {path} is group- or "
93
+ f"world-writable (mode {info.st_mode & 0o7777:04o})"
94
+ )
95
+ if not info.st_mode & 0o111:
96
+ raise PermissionError(
97
+ f"recovery interpreter is not a trusted executable: {path} has no execute "
98
+ f"bits (mode {info.st_mode & 0o7777:04o})"
99
+ )
81
100
  digest = hashlib.sha256()
82
101
  while block := os.read(descriptor, 1024 * 1024):
83
102
  digest.update(block)
@@ -16,6 +16,7 @@ import json
16
16
  import logging
17
17
  import os
18
18
  from pathlib import Path
19
+ import resource
19
20
  import socket
20
21
  import stat
21
22
  import time
@@ -33,6 +34,28 @@ from execution_transport import (
33
34
 
34
35
  PROTOCOL_VERSION = 1
35
36
  MAX_HEALTH_BYTES = 1024 * 1024
37
+ FILE_DESCRIPTOR_HEADROOM = 8192
38
+
39
+
40
+ def ensure_file_descriptor_headroom() -> None:
41
+ """Raise a small inherited soft limit without replacing OS/user policy.
42
+
43
+ In particular, existing launchd jobs can inherit only 256 descriptors for
44
+ all client sockets, provider pipes, databases and listeners combined. Do
45
+ this in the entrypoint so an updated runtime also fixes older service
46
+ definitions; never lower a larger limit or increase the hard limit.
47
+ """
48
+ try:
49
+ soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
50
+ if soft == resource.RLIM_INFINITY or soft >= FILE_DESCRIPTOR_HEADROOM:
51
+ return
52
+ target = FILE_DESCRIPTOR_HEADROOM if hard == resource.RLIM_INFINITY else min(FILE_DESCRIPTOR_HEADROOM, hard)
53
+ if target > soft:
54
+ resource.setrlimit(resource.RLIMIT_NOFILE, (target, hard))
55
+ except (OSError, ValueError) as error:
56
+ # A restricted host remains usable with its existing limit. Failure to
57
+ # gain headroom is diagnostic information, not a startup/admission gate.
58
+ logging.warning("Could not raise execution file-descriptor soft limit: %s", error)
36
59
 
37
60
 
38
61
  class ProcessLease:
@@ -374,6 +397,7 @@ def main() -> int:
374
397
  parser.error("Invalid listener port")
375
398
  if args.role == "gateway" and args.application != "agent_server:app":
376
399
  parser.error("Only workers load applications")
400
+ ensure_file_descriptor_headroom()
377
401
  try:
378
402
  with ProcessLease(args.runtime_dir, args.role) as lease:
379
403
  asyncio.run(serve_worker(args, lease) if args.role == "worker" else serve_gateway(args, lease))
@@ -400,8 +400,8 @@ class ExecutionTransportServer:
400
400
  _done, pending = await asyncio.wait(tuple(self._connections), timeout=max(0.0, timeout))
401
401
  for task in pending:
402
402
  task.cancel()
403
- # A peer that stopped reading can prevent close() from flushing its
404
- # buffered response indefinitely. Only explicit worker shutdown aborts
403
+ # A connected peer that stopped reading can prevent close() from
404
+ # flushing its buffered response. Explicit worker shutdown aborts
405
405
  # those remaining transports after the drain window.
406
406
  for writer in writers:
407
407
  connection = writer.get_extra_info("socket")
@@ -431,6 +431,16 @@ class ExecutionTransportServer:
431
431
  accepted = False
432
432
  disconnected = asyncio.Event()
433
433
  incoming: asyncio.Queue[dict[str, Any]] = asyncio.Queue(maxsize=4)
434
+
435
+ def disconnect_ingress() -> None:
436
+ disconnected.set()
437
+ # The accepted application keeps its task and queued input, but
438
+ # a departed ingress no longer needs an IPC descriptor or output.
439
+ # Abort also retires a socket with buffered, undeliverable output.
440
+ connection = writer.get_extra_info("socket")
441
+ if connection is not None and connection.fileno() >= 0:
442
+ writer.transport.abort()
443
+
434
444
  try:
435
445
  opening = await asyncio.wait_for(_read_frame(reader), HANDSHAKE_TIMEOUT)
436
446
  _fields(opening, {"v", "kind", "secret", "scope"})
@@ -453,14 +463,18 @@ class ExecutionTransportServer:
453
463
  if frame["kind"] != "event":
454
464
  raise ExecutionTransportError("Unexpected private protocol message")
455
465
  event = _event(frame["event"], encode=False, kind=kind, direction="request")
456
- await incoming.put(event)
457
466
  if event["type"].endswith(".disconnect"):
467
+ # Do not wait behind a full input queue to release
468
+ # the dead socket. receive() still drains every
469
+ # accepted body event before this disconnect.
470
+ disconnect.update(event)
458
471
  break
472
+ await incoming.put(event)
459
473
  except (ExecutionTransportError, asyncio.IncompleteReadError, ConnectionError, OSError):
460
474
  pass
461
475
  # Cancellation by our own completed app's cleanup is not peer
462
476
  # disconnection: leave its bounded input drain enabled.
463
- disconnected.set()
477
+ disconnect_ingress()
464
478
 
465
479
  async def receive() -> dict[str, Any]:
466
480
  if not incoming.empty():
@@ -486,7 +500,7 @@ class ExecutionTransportServer:
486
500
  try:
487
501
  await _write_frame(writer, {"kind": "event", "event": event})
488
502
  except (ConnectionError, OSError):
489
- disconnected.set()
503
+ disconnect_ingress()
490
504
  return
491
505
 
492
506
  pump = asyncio.create_task(read_events(), name="execution-request-reader")
@@ -516,8 +530,10 @@ class ExecutionTransportServer:
516
530
 
517
531
  with suppress(asyncio.TimeoutError, ConnectionError, OSError):
518
532
  await asyncio.wait_for(drain_ingress(), 1.0)
519
- self._writers.discard(writer)
520
- await _close_writer(writer)
533
+ try:
534
+ await _close_writer(writer)
535
+ finally:
536
+ self._writers.discard(writer)
521
537
 
522
538
 
523
539
  class ExecutionGateway:
@@ -544,6 +560,7 @@ class ExecutionGateway:
544
560
  pump: asyncio.Task[Any] | None = None
545
561
  response_started = False
546
562
  expects_trailers = False
563
+ client_disconnected = False
547
564
  try:
548
565
  secret = _read_secret(self.secret_path)
549
566
  identity = _socket_identity(self.socket_path)
@@ -558,11 +575,14 @@ class ExecutionGateway:
558
575
  raise ExecutionTransportError("Execution handshake failed")
559
576
 
560
577
  async def forward_requests() -> None:
578
+ nonlocal client_disconnected
561
579
  try:
562
580
  while True:
563
581
  message = await receive()
564
582
  for chunk in _chunks(message):
565
583
  event = _event(chunk, encode=True, kind=scope["type"], direction="request")
584
+ if event["type"].endswith(".disconnect"):
585
+ client_disconnected = True
566
586
  await _write_frame(writer, {"kind": "event", "event": event})
567
587
  if message["type"].endswith(".disconnect"):
568
588
  writer.close()
@@ -603,6 +623,12 @@ class ExecutionGateway:
603
623
  return
604
624
  except (ExecutionTransportError, asyncio.IncompleteReadError, ConnectionError,
605
625
  OSError, asyncio.TimeoutError):
626
+ if client_disconnected:
627
+ # Closing ingress also closes IPC. Its resulting EOF is normal
628
+ # after an explicit client disconnect; the worker still owns
629
+ # accepted work. Do not report it as an execution failure or
630
+ # synthesize a response to a client that has already left.
631
+ return
606
632
  if not response_started:
607
633
  if scope["type"] == "http":
608
634
  await send({"type": "http.response.start", "status": 503,
@@ -52,6 +52,13 @@ def parse_models(value):
52
52
  model = str(item.get("name") or "").removeprefix("models/")
53
53
  if not MODEL.fullmatch(model) or "generateContent" not in item.get("supportedGenerationMethods", []):
54
54
  continue
55
+ # generateContent also lists audio-only products. These cannot satisfy
56
+ # the text/tool contract of Gemini CLI. Unknown chat families stay in
57
+ # the inventory; do not use a version/deprecation blacklist.
58
+ modalities = item.get("outputModalities")
59
+ if (isinstance(modalities, list) and modalities and "TEXT" not in modalities
60
+ or re.search(r"(?:^|-)tts(?:-|$)", model) or model.startswith("lyria-")):
61
+ continue
55
62
  label = item.get("displayName") or model
56
63
  if not isinstance(label, str) or not label or len(label) > 256 or any(ord(c) < 32 or ord(c) == 127 for c in label):
57
64
  label = model
@@ -107,6 +114,7 @@ async def probe(selected):
107
114
  async with client.stream(method, target, headers=headers, **kwargs) as response:
108
115
  if response.status_code in {400, 401, 403}: return "authentication_failed" if not model or response.status_code != 400 else "unsupported"
109
116
  if response.status_code == 429: return "rate_limited"
117
+ if response.status_code == 404 and model: return "model_unavailable"
110
118
  if response.status_code != 200: return "connection_failed"
111
119
  raw = bytearray()
112
120
  async for chunk in response.aiter_bytes():
package/server/install.sh CHANGED
@@ -89,16 +89,16 @@ INSTANCE_EXPLICIT="false"
89
89
  LABEL="com.agentsdock.server"
90
90
  INSTANCE_LOG_DIR="$HOME/Library/Logs/AgentsServer"
91
91
  LEGACY_SERVICE_NAME="zenithbot-agent"
92
- # AgentsServer's cooperative shutdown has 18 independently bounded cleanup
92
+ # AgentsServer's cooperative shutdown has 19 independently bounded cleanup
93
93
  # phases in addition to uvicorn's graceful window. Five seconds was shorter
94
94
  # than even an ordinary slow shutdown: launchctl had already accepted bootout,
95
95
  # then the installer abandoned activation/rollback and could leave the service
96
96
  # unloaded. Keep this wait bounded, but long enough for the server's complete
97
97
  # worst-case graceful budget before declaring the exact launchd job wedged.
98
- # AgentsServer caps the configurable uvicorn window at 60 seconds; 185 seconds
99
- # covers that window, all 18 five-second teardown phases, the watchdog margin,
98
+ # AgentsServer caps the configurable uvicorn window at 60 seconds; 190 seconds
99
+ # covers that window, all 19 five-second teardown phases, the watchdog margin,
100
100
  # and another 30 seconds for launchd to reap the terminated process.
101
- LAUNCHCTL_STOP_ATTEMPTS=1850
101
+ LAUNCHCTL_STOP_ATTEMPTS=1900
102
102
  LAUNCHCTL_STOP_DELAY=0.1
103
103
  LAUNCHCTL_BOOTSTRAP_ATTEMPTS=3
104
104
  NON_INTERACTIVE="false"
@@ -1846,7 +1846,7 @@ if [[ "$TEAM_HUB_MODE" == "host" && "$TEAM_HUB_OPERATION_PENDING" != "true" \
1846
1846
  fi
1847
1847
  fi
1848
1848
 
1849
- RELEASE_FILES=(activation_transaction.py execution_activation.py execution_legacy_runner.py execution_preparation.py update_preparation.py update_handoff.py update_recovery.py execution_update_status.py execution_uninstall.py execution_recovery.py execution_recovery_status.py execution_http.py execution_durability.py execution_control.py execution_install.py execution_maintenance.py execution_manage.py execution_ownership.py execution_service.py execution_transport.py agent_server.py local_session_ownership.py cursor_history.py workspace_git.py team_hub_host.py secure_peer_runtime.py team_mail_runtime.py team_mail_websocket.py team_mail_grants.py secure_peer_delivery.py agentsdock_jobs.py agentsdock_chats.py chat_mailbox.py agentsdock_emergency.py agentsdock_publish.py agentsdock_mail.py agentsdock_team.py provider_commands.py provider_usage.py claude_sdk_client.py claude_model_catalog.py claude_goals.py claude_background_reconciliation.py codex_app_server.py codex_auth.py codex_provider.py codex_response_stream.py provider_connections.py cursor_api_key.py side_questions.py title_generation.py codex_side_question.py codex_side_chat_progress.py claude_side_question.py cursor_agent_client.py cursor_provider_mcp.py opencode_agent_client.py gemini_acp_client.py gemini_history.py gemini_content.py gemini_import.py gemini_runtime.py gemini_runner.py gemini_permissions.py gemini_api.py cursor_process_guard.py transcript_reader.py claude_history_repair.py claude_history_provenance.py codex_history_repair.py public_chat_shares.py public_chat_transcript.py public_chat_share_routes.py interactive_chat_shares.py interactive_chat_share_routes.py interactive_chat_share_web.py interactive_chat_projection.py interactive_chat_runtime.py interactive_chat_native.py shared_chat_videos.py shared_chat_analytics_web.py shared_chat_video_stream.py interactive_chat_controls.py install.sh uninstall.sh instances.sh server_instances.py npm/agentsdock/pair.cjs npm/agentsdock/qr-renderer.cjs npm/agentsdock/QR-NOTICES.txt update_runner.py pyproject.toml uv.lock VERSION release-public-key.pem LICENSE NOTICE)
1849
+ RELEASE_FILES=(activation_transaction.py execution_activation.py execution_legacy_runner.py execution_preparation.py update_preparation.py update_handoff.py update_recovery.py execution_update_status.py execution_uninstall.py execution_recovery.py execution_recovery_status.py execution_http.py execution_durability.py execution_control.py execution_install.py execution_maintenance.py execution_manage.py execution_ownership.py execution_service.py execution_transport.py agent_server.py local_session_ownership.py cursor_history.py workspace_git.py workspace_intelligence.py team_hub_host.py secure_peer_runtime.py team_mail_runtime.py team_mail_websocket.py team_mail_grants.py secure_peer_delivery.py agentsdock_jobs.py agentsdock_chats.py chat_mailbox.py agentsdock_emergency.py agentsdock_notify.py agentsdock_publish.py agentsdock_mail.py agentsdock_team.py provider_commands.py provider_usage.py session_unread.py claude_sdk_client.py claude_chat_routing.py claude_model_catalog.py claude_goals.py claude_background_reconciliation.py codex_app_server.py codex_auth.py codex_provider.py codex_response_stream.py provider_connections.py cursor_api_key.py side_questions.py title_generation.py codex_side_question.py codex_side_chat_progress.py claude_side_question.py cursor_agent_client.py cursor_provider_mcp.py opencode_agent_client.py gemini_acp_client.py gemini_history.py gemini_content.py gemini_import.py gemini_runtime.py gemini_runner.py gemini_permissions.py gemini_api.py cursor_process_guard.py transcript_reader.py claude_history_repair.py claude_history_provenance.py codex_history_repair.py public_chat_shares.py public_chat_transcript.py public_chat_share_routes.py interactive_chat_shares.py interactive_chat_share_routes.py interactive_chat_share_web.py interactive_chat_projection.py interactive_chat_runtime.py interactive_chat_native.py shared_chat_videos.py shared_chat_analytics_web.py shared_chat_video_stream.py interactive_chat_controls.py install.sh uninstall.sh instances.sh server_instances.py npm/agentsdock/pair.cjs npm/agentsdock/qr-renderer.cjs npm/agentsdock/QR-NOTICES.txt update_runner.py pyproject.toml uv.lock VERSION release-public-key.pem LICENSE NOTICE)
1850
1850
  RELEASE_DIRECTORIES=(agentsdock_team_hub)
1851
1851
  TEAM_HUB_RELEASE_FILES=(
1852
1852
  __init__.py
@@ -3753,12 +3753,15 @@ validate_staged_release_runtime() (
3753
3753
  "$STAGE_DIR/agentsdock_chats.py" \
3754
3754
  "$STAGE_DIR/chat_mailbox.py" \
3755
3755
  "$STAGE_DIR/agentsdock_emergency.py" \
3756
+ "$STAGE_DIR/agentsdock_notify.py" \
3756
3757
  "$STAGE_DIR/agentsdock_publish.py" \
3757
3758
  "$STAGE_DIR/agentsdock_mail.py" \
3758
3759
  "$STAGE_DIR/agentsdock_team.py" \
3759
3760
  "$STAGE_DIR/provider_commands.py" \
3760
3761
  "$STAGE_DIR/provider_usage.py" \
3762
+ "$STAGE_DIR/session_unread.py" \
3761
3763
  "$STAGE_DIR/claude_sdk_client.py" \
3764
+ "$STAGE_DIR/claude_chat_routing.py" \
3762
3765
  "$STAGE_DIR/claude_model_catalog.py" \
3763
3766
  "$STAGE_DIR/claude_goals.py" \
3764
3767
  "$STAGE_DIR/claude_background_reconciliation.py" \
@@ -3768,6 +3771,7 @@ validate_staged_release_runtime() (
3768
3771
  "$STAGE_DIR/provider_connections.py" "$STAGE_DIR/cursor_api_key.py" \
3769
3772
  "$STAGE_DIR/side_questions.py" \
3770
3773
  "$STAGE_DIR/workspace_git.py" \
3774
+ "$STAGE_DIR/workspace_intelligence.py" \
3771
3775
  "$STAGE_DIR/codex_side_question.py" \
3772
3776
  "$STAGE_DIR/codex_side_chat_progress.py" \
3773
3777
  "$STAGE_DIR/title_generation.py" \
@@ -3804,7 +3808,7 @@ validate_staged_release_runtime() (
3804
3808
  "$STAGE_DIR/update_runner.py"
3805
3809
  "$STAGE_DIR/.venv/bin/python" -m py_compile "$STAGE_DIR/server_instances.py"
3806
3810
  "$STAGE_DIR/.venv/bin/python" -m compileall -q "$STAGE_DIR/agentsdock_team_hub"
3807
- PYTHONPATH="$STAGE_DIR" "$STAGE_DIR/.venv/bin/python" -c 'import execution_activation, execution_preparation, update_preparation, update_handoff, update_recovery, execution_update_status, execution_uninstall, execution_recovery, execution_recovery_status, execution_http, execution_durability, execution_control, execution_install, execution_maintenance, execution_manage, execution_ownership, execution_service, execution_transport; import workspace_git, claude_model_catalog, server_instances, local_session_ownership, cursor_history; import codex_auth, codex_provider, codex_response_stream, provider_connections, cursor_api_key, side_questions, title_generation, codex_side_question, codex_side_chat_progress, claude_side_question, agentsdock_team_hub, cursor_agent_client, cursor_provider_mcp, opencode_agent_client, gemini_acp_client, gemini_history, gemini_content, gemini_import, gemini_runtime, gemini_runner, gemini_permissions, gemini_api, cursor_process_guard, secure_peer_delivery, secure_peer_runtime, team_mail_runtime, team_mail_websocket, team_mail_grants, team_hub_host, agentsdock_mail, agentsdock_team, transcript_reader, claude_history_repair, claude_history_provenance, claude_goals, claude_background_reconciliation, codex_history_repair, public_chat_shares, public_chat_transcript, public_chat_share_routes, interactive_chat_shares, interactive_chat_share_routes, interactive_chat_share_web, interactive_chat_projection, interactive_chat_runtime, interactive_chat_native, shared_chat_videos, shared_chat_analytics_web, shared_chat_video_stream, interactive_chat_controls, chat_mailbox, provider_commands, provider_usage; from agentsdock_team_hub import secure_peer, secure_peer_hub' >/dev/null
3811
+ PYTHONPATH="$STAGE_DIR" "$STAGE_DIR/.venv/bin/python" -c 'import execution_activation, execution_preparation, update_preparation, update_handoff, update_recovery, execution_update_status, execution_uninstall, execution_recovery, execution_recovery_status, execution_http, execution_durability, execution_control, execution_install, execution_maintenance, execution_manage, execution_ownership, execution_service, execution_transport; import workspace_git, workspace_intelligence, claude_model_catalog, claude_chat_routing, server_instances, local_session_ownership, cursor_history; import codex_auth, codex_provider, codex_response_stream, provider_connections, cursor_api_key, side_questions, title_generation, codex_side_question, codex_side_chat_progress, claude_side_question, agentsdock_team_hub, cursor_agent_client, cursor_provider_mcp, opencode_agent_client, gemini_acp_client, gemini_history, gemini_content, gemini_import, gemini_runtime, gemini_runner, gemini_permissions, gemini_api, cursor_process_guard, secure_peer_delivery, secure_peer_runtime, team_mail_runtime, team_mail_websocket, team_mail_grants, team_hub_host, agentsdock_mail, agentsdock_team, transcript_reader, claude_history_repair, claude_history_provenance, claude_goals, claude_background_reconciliation, codex_history_repair, public_chat_shares, public_chat_transcript, public_chat_share_routes, interactive_chat_shares, interactive_chat_share_routes, interactive_chat_share_web, interactive_chat_projection, interactive_chat_runtime, interactive_chat_native, shared_chat_videos, shared_chat_analytics_web, shared_chat_video_stream, interactive_chat_controls, chat_mailbox, provider_commands, provider_usage; from agentsdock_team_hub import secure_peer, secure_peer_hub' >/dev/null
3808
3812
  )
3809
3813
 
3810
3814
  abort_unclaimed_team_hub_reactivation() {
@@ -4132,7 +4136,7 @@ for name in "${TEAM_HUB_RELEASE_FILES[@]}"; do
4132
4136
  "$SOURCE_DIR/agentsdock_team_hub/$name" \
4133
4137
  "$STAGE_DIR/agentsdock_team_hub/$name"
4134
4138
  done
4135
- chmod 755 "$STAGE_DIR/agent_server.py" "$STAGE_DIR/agentsdock_jobs.py" "$STAGE_DIR/agentsdock_chats.py" "$STAGE_DIR/agentsdock_emergency.py" "$STAGE_DIR/agentsdock_publish.py" "$STAGE_DIR/agentsdock_mail.py" "$STAGE_DIR/agentsdock_team.py" "$STAGE_DIR/install.sh" "$STAGE_DIR/uninstall.sh" "$STAGE_DIR/update_runner.py"
4139
+ chmod 755 "$STAGE_DIR/agent_server.py" "$STAGE_DIR/agentsdock_jobs.py" "$STAGE_DIR/agentsdock_chats.py" "$STAGE_DIR/agentsdock_emergency.py" "$STAGE_DIR/agentsdock_notify.py" "$STAGE_DIR/agentsdock_publish.py" "$STAGE_DIR/agentsdock_mail.py" "$STAGE_DIR/agentsdock_team.py" "$STAGE_DIR/install.sh" "$STAGE_DIR/uninstall.sh" "$STAGE_DIR/update_runner.py"
4136
4140
  chmod 755 "$STAGE_DIR/instances.sh"
4137
4141
 
4138
4142
  if [[ "$PREPARE_ONLY" == "true" ]]; then
@@ -7015,15 +7019,31 @@ fi
7015
7019
  # links or configuration. Legacy runners can report a failed installer, so an
7016
7020
  # unfinished journal must never leave their old, unfenced API accepting work.
7017
7021
  if [[ "${EXECUTION_MODE:-legacy}" == "split" ]]; then
7018
- if ! execution_activation_command durability "$STAGE_DIR" \
7019
- || ! execution_recovery_arm "$STAGE_DIR" \
7020
- || ! record_activation_phase quiescing "$STAGE_DIR" \
7021
- || ! execution_stop_services "$STAGE_DIR" preflight \
7022
- || ! execution_activation_command suppress "$STAGE_DIR" \
7023
- || ! execution_stop_services "$STAGE_DIR" stop \
7024
- || ! record_activation_phase quiesced "$STAGE_DIR"; then
7022
+ # Name the quiesce boundary that actually failed. Arming the activation
7023
+ # recovery owner validates the recovery interpreter's ownership and
7024
+ # permission bits, which needs a different operator response than a native
7025
+ # service-stop failure; the single generic message below previously blamed
7026
+ # the service stop for every failure in this chain.
7027
+ ACTIVATION_QUIESCE_BOUNDARY=""
7028
+ if ! execution_activation_command durability "$STAGE_DIR"; then
7029
+ ACTIVATION_QUIESCE_BOUNDARY="recording activation durability evidence"
7030
+ elif ! execution_recovery_arm "$STAGE_DIR"; then
7031
+ ACTIVATION_QUIESCE_BOUNDARY="arming the activation recovery owner"
7032
+ elif ! record_activation_phase quiescing "$STAGE_DIR"; then
7033
+ ACTIVATION_QUIESCE_BOUNDARY="journaling the quiescing phase"
7034
+ elif ! execution_stop_services "$STAGE_DIR" preflight; then
7035
+ ACTIVATION_QUIESCE_BOUNDARY="preflighting the admitted execution service"
7036
+ elif ! execution_activation_command suppress "$STAGE_DIR"; then
7037
+ ACTIVATION_QUIESCE_BOUNDARY="suppressing the admitted execution service"
7038
+ elif ! execution_stop_services "$STAGE_DIR" stop; then
7039
+ ACTIVATION_QUIESCE_BOUNDARY="stopping the admitted execution service"
7040
+ elif ! record_activation_phase quiesced "$STAGE_DIR"; then
7041
+ ACTIVATION_QUIESCE_BOUNDARY="journaling the quiesced phase"
7042
+ fi
7043
+ if [[ -n "$ACTIVATION_QUIESCE_BOUNDARY" ]]; then
7025
7044
  [[ "$COLD_TEAM_HUB_HANDOFF" != "true" ]] || resume_install_signals
7026
7045
  echo "The admitted execution service could not be durably stopped before takeover." >&2
7046
+ echo " The failure occurred while $ACTIVATION_QUIESCE_BOUNDARY; the error above identifies the specific cause." >&2
7027
7047
  exit 1
7028
7048
  fi
7029
7049
  fi