Closed bug report

0.2.100: script verbs (build_schematic, create_symbol) refuse with agent_resident; loaded agent watches the legacy workspace, agent_stop cannot stop it

JelleJocque · ·closed by Colby Knox

altium-bridge 0.2.100 · Adom Bridge 2.1.194 (d7d91787) · Hydrogen 1.0.765 · Altium Designer Develop (26.x, licensed) · Windows 11

Summary. Since the auto-update to 0.2.100 (ab lifecycle: "applying the update to 0.2.100", 2026-11-17 08:50), every verb that runs as its own script refuses with agent_resident, even right after all loops were stopped. altium_build_schematic waits ~390 s and then returns it. The same scripted flow (build_schematic, sch_place_part, sch_connect, create_symbol on a 15-sheet project) worked on 0.2.96 on 2026-11-11.

Exact errors.

  • altium_build_schematic → errorCode: agent_resident, error: "an Adom agent loop is resident; a second script would raise Altium's 'Another script executing now' modal" (after 391 s).
  • altium_create_symbol → same agent_resident, or "agent did not heartbeat within 74s, including one re-sent bootstrap", or "'altium_create_symbol' did not respond within ab's 90s budget".
  • altium_open_document → agent_resident / timed_out (60 s).

Likely cause (workspace mismatch).

  • The bridge selects the per-instance workspace C:/Users/<user>/AppData/Local/Adom Bridge/bridges-cache/altium/agent/ADDevelop (altium_agent_status.workspace).
  • But the agent script Altium has loaded (AdomAgent_f6db80ee7c.pas, visible in the editor) has WORKSPACE = 'C:\Users\<user>\AppData\Local\Adom Bridge\bridges-cache\altium\agent\', the legacy shared folder.
  • So altium_agent_status reads alive:false with residentAnywhere:true, liveWorkspaces:[{workspace: ".../altium/agent"}] and the hint "A loop is resident in another workspace … altium_close stops every workspace's loop".
  • altium_agent_stop drops its stop file in ADDevelop/, which the running loop does not watch, so it never stops. altium_agent_recover starts another loop.
  • Dropping a stop file by hand into .../altium/agent/ does stop it (residentAnywhere → false), but the next script verb (build_schematic) bootstraps a loop into the legacy workspace again and then refuses its own script with agent_resident.
  • Same family as the closed #1065 (legacy-workspace agent invisible to the per-instance view).

Repro. Fresh Altium Designer Develop start, project open, then altium_build_schematic {schPath, projectPath, libraryPath, pcbLibPath, parts:[13 parts], nets:{}} → agent_resident after ~6.5 min. altium_create_symbol of a 13-part, 621-pin multi-part symbol fails the same way; a 5-part, 172-pin one fails with the heartbeat error.

Expected. The loaded agent uses the selected per-instance workspace (or stop/status cover the legacy one), and script verbs stop or reuse the resident loop instead of refusing.

Also. Releases list 0.2.101 (2026-11-16) but the page manifest still serves 0.2.100, so a fix in 0.2.101 (if any) does not reach users. There is also no way to pin or roll back a bridge version (no per-release manifest).

2 Replies

JelleJocque ·

Root cause found, and a local workaround confirmed.

bridge-rs/src/lifecycle.rs:

  • install() picks the script's folder with one call to agent::workspace_dir(): .../agent/ADDevelop, the selected instance.
  • The path written into the script comes from a second, independent call inside rendered() → ws_str() → agent::workspace_dir().
  • workspace_dir() depends on instance::selected(). If that returns None at the moment of the second call (e.g. while Altium is starting), it falls back to the legacy root .../agent/.
  • The result: ADDevelop/AdomAgent_<gen>.pas carrying WORKSPACE = '...\agent\'.

Because install() only writes when !pas.exists(), the wrong path then persists for that template generation, across Altium restarts and bridge respawns. From then on:

  • the loop's heartbeat (hb.txt) and stop file live in the legacy folder;
  • agent_status / agent_stop look in ADDevelop/;
  • script verbs refuse with agent_resident.

Suggested fix:

  1. Compute ws once in install() and pass it to rendered(raw, &ws), instead of calling workspace_dir() again.
  2. Treat an existing .pas whose WORKSPACE literal differs from ws as stale and rewrite it, which repairs installs already affected.

Workaround that worked here (Altium closed first): in .../agent/ADDevelop/AdomAgent_f6db80ee7c.pas, line 25, change WORKSPACE = '...\altium\agent\' to '...\altium\agent\ADDevelop\'. After relaunch, altium_build_schematic returned in 11 s, and altium_agent_status shows alive:true with the live workspace .../agent/ADDevelop.

Colby Knox marked this in progress ·
Colby Knox ·

Thank you, Jelle. Your root cause was exactly right, and it saved a lot of time. Fixed in altium-bridge 0.2.102, which is public now. Adom Bridge picks it up with its next update check, or right away from the bridge's update button.

What changed

  • The agent's folder is chosen once, and that same folder goes into the script, its file name and the start that runs it. If the Altium instance is lost in between (while Altium is starting), the start now refuses with instance_unresolved instead of landing in the shared legacy folder.
  • The script's file name now covers the folder written inside it. So a script written for the wrong folder by an earlier version, like your AdomAgent_f6db80ee7c.pas, is never used again: the first start writes a new one with the right path. Your hand edit does no harm and needs no undoing.
  • A loop already running from the legacy folder is stopped before a start, altium_eval or altium_run_script. altium_agent_stop stops it too, and reports it as strandedLoopStopped. Another Altium's own loop is left alone.

How it was tested: I started an agent loop from a script pointing at the legacy folder, which gave the same alive:false and residentAnywhere:true you saw. Then:

  • altium_agent_stop, altium_eval and altium_agent_start each stopped that loop in 0.2 s and carried on.
  • The new agent ran in the instance's own folder.
  • altium_build_schematic returned in 10 s.

On 0.2.101 and versions: 0.2.101 was an insiders build, which is why public still served 0.2.100. 0.2.102 includes it. Every release's zip stays downloadable from the Releases tab. Pinning or rolling back one bridge is up to Adom Bridge itself, so a request on adom/adom-bridge is the place for that.

If anything still refuses with agent_resident on 0.2.102, reopen this with the altium_agent_status reply and I'll look straight away.

Colby Knox closed this ·

Log in to reply.