Skip to content

Conversation

@zzhangpurdue
Copy link
Collaborator

Description

  1. make sure the deploy id is fully displayed
  2. deduplicate deploy id based on deploy info, since some deployment might be failed during deploying process.

Related Issue: Fixes #[issue_number] or Relates to #[issue_number]

Security Considerations: [If applicable, especially for sandbox changes]

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Engine
  • Sandbox
  • Tools
  • Common
  • Documentation
  • Tests
  • CI/CD

Checklist

  • Pre-commit hooks pass
  • Tests pass locally
  • Documentation updated (if needed)
  • [ x] Ready for review

Testing

[How to test these changes]

Additional Notes

[Optional: any other context]

from pathlib import Path
from typing import Optional, List, Dict, Any

import logging
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to line 5?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes a CLI display bug where deployment IDs were truncated in the list output, and addresses an issue with incomplete deployment records appearing in the list. The changes filter out deployments missing the agent_source field and display full deployment IDs instead of truncating them.

Changes:

  • Display full deployment IDs in CLI list output (removed 30-character truncation)
  • Filter out incomplete deployments without agent_source at both state manager and CLI levels
  • Replace print statements with proper logging using Python's logging module

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/agentscope_runtime/engine/deployers/state/manager.py Added logging, filters deployments without agent_source in _read_state(), adds warning when saving incomplete deployments
src/agentscope_runtime/cli/commands/list_cmd.py Removes ID truncation, filters incomplete deployments, and re-sorts the deployment list
.gitignore Adds entries for .qwen AI assistant files (similar to existing .claude entries)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +73 to +89
# agent_source)
complete_deployments = []
for d in deployments:
# Check if the deployment has complete information
# A complete deployment should have agent_source and other
# required fields
if d.agent_source: # Filter out deployments without agent_source
complete_deployments.append(d)

# Sort the final list by created_at (newest first) to maintain
# consistency
deployments = sorted(
complete_deployments,
key=lambda x: x.created_at,
reverse=True,
)

Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sorting operation is redundant because DeploymentStateManager.list() already sorts deployments by created_at in reverse order (line 305 in manager.py). Performing the same sort operation again is unnecessary and impacts performance. Consider removing this duplicate sorting logic.

Suggested change
# agent_source)
complete_deployments = []
for d in deployments:
# Check if the deployment has complete information
# A complete deployment should have agent_source and other
# required fields
if d.agent_source: # Filter out deployments without agent_source
complete_deployments.append(d)
# Sort the final list by created_at (newest first) to maintain
# consistency
deployments = sorted(
complete_deployments,
key=lambda x: x.created_at,
reverse=True,
)
# agent_source) while preserving the order provided by
# DeploymentStateManager.list()
deployments = [
d for d in deployments
if d.agent_source # Filter out deployments without agent_source
]

Copilot uses AI. Check for mistakes.
Comment on lines +72 to +81
# Filter out incomplete deployments (missing required fields like
# agent_source)
complete_deployments = []
for d in deployments:
# Check if the deployment has complete information
# A complete deployment should have agent_source and other
# required fields
if d.agent_source: # Filter out deployments without agent_source
complete_deployments.append(d)

Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment here states deployments are being filtered based on missing required fields, but this creates confusion about data requirements. In the Deployment schema, agent_source is defined as a required field (not Optional), yet all deployers use kwargs.get("agent_source") which can return None. This inconsistency should be resolved by either: (1) making agent_source Optional[str] in the schema if it's acceptable for it to be missing, or (2) ensuring all deployers always provide agent_source when creating Deployment objects. The current approach of filtering at read/list time is a workaround that obscures the real problem.

Suggested change
# Filter out incomplete deployments (missing required fields like
# agent_source)
complete_deployments = []
for d in deployments:
# Check if the deployment has complete information
# A complete deployment should have agent_source and other
# required fields
if d.agent_source: # Filter out deployments without agent_source
complete_deployments.append(d)
# Filter out deployments that do not have an agent_source.
# This is a CLI-level safeguard to avoid showing entries that lack
# the metadata needed for display, even if they exist in state.
complete_deployments = []
for d in deployments:
# Only include deployments that have agent_source populated
if d.agent_source:
complete_deployments.append(d)

Copilot uses AI. Check for mistakes.
Comment on lines +120 to +122
# Check if required fields are present
if deployment.agent_source:
valid_deployments[deploy_id] = deploy_data
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filtering logic here checks if agent_source is truthy, but according to the Deployment dataclass schema, agent_source is a required field (not Optional). If a deployment record is missing agent_source, Deployment.from_dict() at line 119 should already fail with a TypeError. This additional check at line 121 is redundant and creates confusion about whether agent_source is truly required. Consider removing this check since the schema validation already enforces it, or if agent_source should be optional, update the schema to reflect that.

Suggested change
# Check if required fields are present
if deployment.agent_source:
valid_deployments[deploy_id] = deploy_data
# Deployment.from_dict enforces required fields;
# if this succeeds, keep the deployment entry.
valid_deployments[deploy_id] = deploy_data

Copilot uses AI. Check for mistakes.
Comment on lines +246 to +253
# Issue a warning if required fields are missing
if not deployment.agent_source:
logger.warning(
f"Warning: Saving deployment {deployment.id} without "
f"agent_source. This indicates an incomplete deployment "
f"record.",
)

Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning message checking if agent_source is falsy is inconsistent with the Deployment dataclass schema where agent_source is a required field (not Optional). If agent_source is truly required, this warning will never be useful because Deployment.from_dict() would fail before this point. If agent_source should be optional to handle incomplete deployments, update the schema to make it Optional[str] instead. This inconsistency between schema definition and runtime checks creates confusion about data requirements.

Suggested change
# Issue a warning if required fields are missing
if not deployment.agent_source:
logger.warning(
f"Warning: Saving deployment {deployment.id} without "
f"agent_source. This indicates an incomplete deployment "
f"record.",
)

Copilot uses AI. Check for mistakes.
Comment on lines +72 to +85
# Filter out incomplete deployments (missing required fields like
# agent_source)
complete_deployments = []
for d in deployments:
# Check if the deployment has complete information
# A complete deployment should have agent_source and other
# required fields
if d.agent_source: # Filter out deployments without agent_source
complete_deployments.append(d)

# Sort the final list by created_at (newest first) to maintain
# consistency
deployments = sorted(
complete_deployments,
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This filtering logic duplicates the filtering already performed in DeploymentStateManager._read_state() (lines 119-122 of manager.py). The state manager already filters out deployments without agent_source when reading the state, so this additional filtering is redundant. This creates maintenance overhead as the filtering logic would need to be updated in two places if requirements change. Consider removing this duplication and relying on the state manager's filtering.

Suggested change
# Filter out incomplete deployments (missing required fields like
# agent_source)
complete_deployments = []
for d in deployments:
# Check if the deployment has complete information
# A complete deployment should have agent_source and other
# required fields
if d.agent_source: # Filter out deployments without agent_source
complete_deployments.append(d)
# Sort the final list by created_at (newest first) to maintain
# consistency
deployments = sorted(
complete_deployments,
# Sort the final list by created_at (newest first) to maintain
# consistency
deployments = sorted(
deployments,

Copilot uses AI. Check for mistakes.
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