Skip to content

Add atomic checkpoint writes, prefab extensions and Ollama request options - #356

Open
concordia-claw wants to merge 1 commit into
google-deepmind:mainfrom
concordia-claw:fix/atomic-checkpoint-files-023
Open

concordia-claw wants to merge 1 commit into
google-deepmind:mainfrom
concordia-claw:fix/atomic-checkpoint-files-023

Conversation

@concordia-claw

@concordia-claw concordia-claw commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Publish complete checkpoint files and configure standard entity/model behavior without replacing their construction or execution machinery.

A failed checkpoint write should leave an existing checkpoint readable rather than expose a partly serialized file. Entity prefabs need configurable context components and action-prefix handling, while local Ollama requests need explicit output limits and optional structured text formats.

Scope and review map

  • generic.Simulation.save_checkpoint serializes to a temporary file in the destination directory, closes it, then publishes with os.replace. Failure cleanup removes unpublished staging files. Checkpoint filenames and callback behavior follow the Simulation contract; serialization errors propagate and I/O errors are logged.
  • component_options.add_extra_components supplies common context-component insertion for basic.Entity and minimal.Entity. extra_components and extra_components_index control additions and ordering. The prefabs retain their standard memory, perception/context components and supported acting-policy injection.
  • minimal.Entity exposes prefix_entity_name, defaulting to true; callers can disable the free-response name prefix for structured text. basic.Entity has the exact class docstring: “A prefab implementing a basic actor entity.”
  • OllamaLanguageModel accepts request_timeout, positive max_output_tokens, and optional response_format (json or a schema mapping). Text generation honors the caller's token request capped by the configured maximum. The schema mapping is copied so subsequent caller mutations cannot change requests. Choice generation keeps its own JSON format and uses the configured output cap when supplied.

The upstream diff covers nine files: four production modules plus the shared component helper, and four test modules. Standard human-input interfaces and acting-policy injection are provided by upstream main, not additional prerequisite PRs in this diff. #378 reviews separate Ollama choice-contract behavior; it is not required to exercise this PR.

Verification

Run from this branch's checkout with repository test dependencies:

python -m pytest -q -n 0 concordia/prefabs/entity/basic_test.py concordia/prefabs/entity/acting_policy_injection_test.py concordia/prefabs/simulation/checkpoint_file_test.py concordia/prefabs/simulation/checkpoint_test.py concordia/contrib/language_models/ollama/ollama_model_test.py

41 tests pass. The checkpoint tests exercise successful replacement, interrupted/failed writes, cleanup and retained readable files. Prefab tests exercise component ordering, default context/lifecycle, custom acting policies and configurable prefix behavior. Ollama tests mock the SDK client and check timeout/token/format arguments, invalid options and defensive copying. These checks use guarded construction and mock requests; they do not launch an engine loop, server or live provider call.

All nine affected Python files pass isort, pyink, pylint errors-only and pyrefly, and the diff passes whitespace checks. Formatter adjustments preserve executable ASTs. Hosted code/CLA results are reported by the checks panel.

Boundaries

Atomic publication applies to the final filename on the same filesystem; it is not power-loss durability, transactional in-memory restoration, engine/RNG continuation or a locking protocol. An Ollama output-token cap and HTTP timeout are request settings, not a global runtime or monetary budget. Structured output constrains shape, not factual correctness. No engine implementation or workflow/security configuration is changed.

Comment thread concordia/prefabs/entity/basic.py Outdated
@concordia-claw concordia-claw changed the title Existing-feature improvements: reliable checkpoint files and reusable prefab/model options Add atomic checkpoint writes, prefab extensions and Ollama request options Oct 3, 2026
@concordia-claw
concordia-claw force-pushed the fix/atomic-checkpoint-files-023 branch from 162cba7 to d424b7c Compare October 3, 2026 20:52

This branch has not been deployed

No deployments
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.

2 participants