Skip to content

fix: detect arch from current environment in config add_agent #28

Merged
Zhiyue-Wang merged 14 commits into
mainfrom
feature/runtime
Jul 9, 2026
Merged

fix: detect arch from current environment in config add_agent #28
Zhiyue-Wang merged 14 commits into
mainfrom
feature/runtime

Conversation

@Zhiyue-Wang

Copy link
Copy Markdown
Collaborator

No description provided.

wangzhiyue and others added 9 commits June 22, 2026 17:26
The add_agent command did not call detect_arch() when creating a new
agent, so arch fell back to the model default (x86_64) regardless of
the host architecture. Call detect_arch() and pass it to BaseConfig
to align with the init command path.

Add unit tests for detect_arch() and for arch auto-detection in
add_agent.
- Pass SessionCreateRequest object (not a pre-converted dict) to
  create_memory_session in MemorySession.__init__ and
  AsyncMemorySession._ensure_initialized, avoiding a double to_dict
  AttributeError since the data plane calls to_dict() internally.
- Fix get_message argument order in both sessions to forward
  (message_id, space_id, session_id) matching the data plane signature;
  the previous (space_id, session_id, message_id) order scrambled
  space_id and message_id.
- Add regression tests asserting call conventions for both sync and
  async sessions.
Add a storage_config block (sfs_turbo: {sfs_turbo_id, sfs_path,
mount_path, read_only}) to runtime creation, forwarded in the
create/update runtime API payload and surfaced in the YAML
generated by both `agentarts init` and `agentarts config`.

- config models: add SfsTurboConfig (sfs_turbo_id validated as UUID
  via pattern) and StorageConfig; default to nested instances
  (mirroring network_config/vpc_config) so config-generated YAML
  includes the full block.
- init scaffold: include the storage_config/sfs_turbo example block.
- deploy: only enforce mount_path when sfs_turbo_id is set, so an
  unset/all-null storage_config never blocks deploy; forward the
  populated dict to create_or_update_agent.
- runtime_client: thread storage_config through create_agent,
  update_agent, and create_or_update_agent (both create and update
  branches).
- tests: model to_dict/UUID validation, init YAML block, config
  add_agent block, deploy forwarding, no-block-when-unconfigured,
  and required mount_path when id is set.
The V11 signer percent-encoded '/' in canonical query values (e.g.
upload's `path`=/home/user/test.txt -> %2Fhome%2Fuser%2Ftest.txt),
which mismatched the data-plane gateway's canonicalisation and caused
IAM signature verification to fail for upload (while invoke, with no
query params, succeeded).

- signer_v11: encode query values with quote(safe="~/") so '/' is
  preserved. No-op for values without '/' (all other V11-signed
  requests), only affects '/'-bearing values like upload's `path`.
- http_client/signer_v11: emit canonical_request / string_to_sign /
  Authorization / content-type via logger.debug, controlled by the
  SDK log level (AGENTARTS_LOG_LEVEL=DEBUG); no separate config.
- tests: regression tests for canonical query (slash kept, sorted,
  simple values unchanged, list values, special chars still encoded).
Add an optional `swr_instance_id` (UUID format) field to
ArtifactSourceConfig, surfaced in the YAML generated by both
`agentarts init` and `agentarts config`.

- config model: swr_instance_id with UUID pattern, default None.
  to_dict(exclude_none) includes it only when set, so it flows into
  the artifact_source payload automatically (no deploy change needed).
- init scaffold: add `swr_instance_id: null` to the artifact_source
  block; config command picks it up via the model default.
- tests: UUID validation, to_dict inclusion/exclusion, and both
  init/config generated YAML contain the field.
The CreateCoreRuntime API expects sfs_turbo as an Array of
CoreRunSfsTurboStorageConfig objects (up to 5 mount points). The SDK was
sending a single dict instead of a list, causing the mount config to be
rejected by the backend.

Fixes:
- StorageConfig.to_dict(): wraps sfs_turbo in a list [{...}] when
  sfs_turbo_id is set; returns {} when unconfigured (was returning
  {'sfs_turbo': {'read_only': False}} — not empty).
- SfsTurboConfig.read_only: default None (was False) so it's only sent
  when explicitly set (exclude_none now excludes it).
- deploy: updated to handle the list format from to_dict().
- Tests: updated assertions to expect list format + None read_only.
Some long-running commands (e.g. large file processing, ML inference)
need more than 300s. Increase the max timeout for exec-command from
300s to 1000s in both the CLI layer and the operations layer.
…eout

The timeout parameter was only used as the HTTP client timeout, but
the backend needs it in the request body to enforce the command execution
deadline. Now:
- timeout is sent in the JSON body: {"command": [...], "timeout": N}
- HTTP client timeout is set to timeout + 60s to allow for network overhead
…ndpoint

The control plane RuntimeClient used in _get_data_endpoint (for endpoint
resolution) and _check_file_transfer_enabled was constructed without a
timeout, defaulting to 30s. Users who set a large --timeout only had it
applied to the data plane exec_command call, not the preceding control
plane calls. If the control plane was slow, users saw a timeout (~10-30s)
before the command even started executing.

Fix: thread the user's timeout through _get_data_endpoint and
_check_file_transfer_enabled to the control plane RuntimeClient.
start_session/stop_session don't have a user-facing timeout param, so
they keep the default 30s (appropriate for quick control plane calls).
@Zhiyue-Wang
Zhiyue-Wang merged commit afea183 into main Jul 9, 2026
10 checks passed
jsuwuj pushed a commit to jsuwuj/agentarts-sdk-python that referenced this pull request Jul 17, 2026
fix: The network administrator name does not support capital letters …
jsuwuj pushed a commit to jsuwuj/agentarts-sdk-python that referenced this pull request Jul 17, 2026
fix: detect arch from current environment in config add_agent
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