Skip to content

fix: restore saved agent state across restarts, and release 0.8.3 - #80

Merged
milliondreams merged 6 commits into
rustic-ai:mainfrom
milliondreams:main
Dec 1, 2026
Merged

milliondreams merged 6 commits into
rustic-ai:mainfrom
milliondreams:main

Conversation

@milliondreams

Copy link
Copy Markdown
Contributor

Fixes found while testing Rustic Studio with guild state kept on disk, plus Forge 0.8.3. Studio's DiskCache default depends on these.

Changes

Restore saved state when an agent starts (790140b, forge-python)

  • An agent starts with an empty local copy of its own state and of the guild state, and only fills it from state responses. After a relaunch nothing sent it what the state manager had kept, so a guild with a persistent store behaved as if its state were gone.
  • When an agent first reports running, the guild manager now sends it its saved state and the guild state on the state topic. State that was never saved isn't sent.

State manager defaults for relaunched guilds (0c79f82)

  • A guild got its default state manager, and the cache_dir DiskCache needs, only when it was created. A guild stored before a default was configured was relaunched without either, so its manager read DiskCache from the environment with no cache_dir and stopped.
  • Every guild manager spawn is rebuilt from the stored guild, and that rebuild now applies the same defaults as bootstrap, through a shared ApplyStateManagerDefaults. A guild that names its own state manager keeps it.

Clear agent statuses left by the previous run (8af1c14)

  • The embedded NATS keeps its data across restarts, agent statuses included. After an abrupt exit, a guild manager's status still read as running for up to its 30-second lease. A relaunch in that window was skipped, so the guild never started and its chat stayed on the launching screen.
  • When the server boots its own embedded NATS, which no other node shares, it now clears the statuses the previous run left. External NATS and Redis still rely on the lease.

Model names for blueprint templates (deaed10)

  • A template listing the models picked for a multiple profile selection only got their keys, because templates were rendered from the raw configuration before selections were resolved. Templates now see each selected profile as {key, display_name}, which the schemas already allow; the guild keeps the keys.

Versions

  • 0.8.3 (ad4e363).
  • Require rusticai-core>=1.5.2 (13c756d), for the Todo agent fixes released in 1.5.2.

Validation

  • go test ./... passes, and golangci-lint v2.15.0 reports 0 issues.
  • New Go tests cover:
    • ApplyStateManagerDefaults;
    • the persisted manager spawn rebuild;
    • NATSAgentStatusStore.Clear;
    • model names in templates.
  • forge-python: ruff passes; 58 unit tests (6 of them new, for the saved-state hand-off) and 6 contract tests pass on rusticai-core 1.5.2.
  • Checked end to end in Rustic Studio on a local build:
    • Saved Todo tasks came back after a restart.
    • A guild stored without a state manager relaunched cleanly.
    • A chat opened 24 s after an abrupt stop relaunched at once, where it was stuck before.
    • The Multi-LLM /add-agent form listed model names.
  • Not run here: tests/test_forge_integration.py and tests/test_forge_api_contract.py. Their harness needs FORGE_LOCAL_USER_ID, FORGE_LOCAL_ORGANIZATION_ID and a registry path that isn't set up on this machine.

An agent starts with an empty local copy of its own state and of the guild
state, and only fills it from state responses. After a relaunch nothing sent
it what the state manager had kept, so a guild with a persistent state store
behaved as if its state were gone.

When an agent first reports running, the guild manager now sends it its saved
state and the guild state on the state topic. State that was never saved is
not sent.
A guild gets its default state manager, and the configuration DiskCache
needs, only when it is created. A guild stored before a default was configured
was relaunched without either, so its manager read DiskCache from the
environment with no cache_dir and stopped.

Every Guild Manager spawn is rebuilt from the stored guild. That rebuild now
applies the same state manager defaults as bootstrap, through a shared
ApplyStateManagerDefaults. A guild that names its own state manager keeps it.
The embedded NATS keeps its data across restarts, agent statuses included.
After an abrupt exit, a guild manager's status still read as running for up to
its 30-second lease. A relaunch in that window was skipped, so the guild never
started and its chat stayed on the launching screen.

When the server boots its own embedded NATS, which no other node shares, it
now clears the statuses the previous run left. External NATS and Redis keep
relying on the lease.
A blueprint template that lists the models picked for a multiple profile
selection only ever got their keys, because templates are rendered from the
raw configuration before the selections are resolved. The Multi-LLM Guild's
/add-agent form therefore offered llm_local_qwen3_5_2b instead of Qwen 3.5 2B
Balanced.

Templates now see each selected profile as {key, display_name}, which the
blueprint schemas already allow. The guild keeps the keys.
Forge 0.8.3 runs the Todo agent fixes and the refresh flag that rusticai-core
1.5.2 adds.
@milliondreams
milliondreams merged commit 3e274a4 into rustic-ai:main Dec 1, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant