Skip to content

[codex] Fix best practice resource update and lookup regressions#257

Draft
07-clottattoos-cyber wants to merge 1 commit intodeepmodeling:mainfrom
07-clottattoos-cyber:codex/best-practice-workflow-fix
Draft

[codex] Fix best practice resource update and lookup regressions#257
07-clottattoos-cyber wants to merge 1 commit intodeepmodeling:mainfrom
07-clottattoos-cyber:codex/best-practice-workflow-fix

Conversation

@07-clottattoos-cyber
Copy link
Copy Markdown

Summary

This PR fixes two regressions that currently break the official best_practice example workflow described in the documentation.

The affected workflow is the documented example that:

  1. uses host_node/create_resource to create or update liquid in an existing container
  2. uses workstation/PumpTransferProtocol to transfer that liquid into another container

In v0.10.19, the workflow can fail in two places:

  • create_resource crashes when updating an existing RegularContainer
  • PumpTransferProtocol can fail to resolve from_vessel=container during resource lookup

Closes #256.

Root cause

The first regression comes from an API mismatch during the container state refactor:

  • RegularContainer now relies on serialize_state()/load_state()
  • the update path in append_resource still directly accesses .state

The second regression comes from resource lookup being too bridge-dependent:

  • the documented workflow passes a bare vessel id like container
  • the remote lookup path does not always resolve that identifier correctly
  • the local host already has enough resource context to resolve it safely

Changes

  • make append_resource update container state through the current resource state API, while keeping compatibility with legacy .state
  • resolve resources locally in host_node before falling back to bridge requests
  • add a startup-config-based fallback for local resource resolution when needed by the running workflow context

Validation

Validated in an isolated environment against the official documented workflow:

  • host_node/create_resource succeeds when targeting an existing container
  • workstation/PumpTransferProtocol succeeds afterwards
  • the end-to-end cloud-triggered workflow completes successfully

Additional local check:

  • python -m py_compile unilabos/ros/nodes/base_device_node.py unilabos/ros/nodes/presets/host_node.py

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.

best_practice 工作流在 v0.10.19 中更新已有 container 时崩溃

2 participants