Skip to content

initial the create_time to actual timestamp#113

Merged
xieyxclack merged 3 commits intoagentscope-ai:mainfrom
Osier-Yi:mock_session_timestamp
Jan 30, 2026
Merged

initial the create_time to actual timestamp#113
xieyxclack merged 3 commits intoagentscope-ai:mainfrom
Osier-Yi:mock_session_timestamp

Conversation

@Osier-Yi
Copy link
Member

@Osier-Yi Osier-Yi commented Jan 28, 2026

📝 PR Type

  • Add new sample
  • Update existing sample
  • Add new test cases
  • Fix test failures
  • Documentation/Configuration update

📚 Description

Resolve an issue where MockSession created MockMessage instances without a valid timestamp. The session now supplies a real (UTC) timestamp by default.

related issue: #108

🧪 Testing Validation

[Please explain how to validate the changes:

  1. How to run the added/modified test cases?
  2. Is integration testing with agentscope required?
  3. Has code been formatted (e.g., pre-commit)?]

✅ Checklist

Please complete the following checks before submitting the PR:

  • All sample code has been formatted with pre-commit run --all-files
  • All new/modified test cases have passed (run pytest tests/)
  • Test coverage has not decreased (if applicable)
  • Sample code follows agentscope best practices (e.g., config management, logging)
  • Related documentation in agentscope-samples has been updated (e.g., README.md)

@Osier-Yi Osier-Yi requested review from a team, rayrayraykk and xieyxclack January 28, 2026 11:59
@gemini-code-assist
Copy link

Summary of Changes

Hello @Osier-Yi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where mock message instances were created without valid timestamps. It ensures that MockFileBase and MockMessage objects are initialized with accurate UTC timestamps, improving data consistency and addressing the related issue #108. Additionally, the MockMessage class has been refactored into a dataclass with improved default field initialization.

Highlights

  • Timestamp Initialization: The create_time and update_time fields in both MockFileBase and MockMessage classes are now correctly initialized with the current UTC timestamp using datetime.now(timezone.utc).isoformat(), replacing the static placeholder 'xxxyyy'.
  • MockMessage Class Enhancement: The MockMessage class has been converted into a dataclass. Its id field now uses uuid.uuid4 as a default factory, and the files field uses a list default factory, ensuring proper default initialization for mutable types.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request resolves an issue with mock messages having invalid timestamps by initializing create_time and update_time with the actual UTC timestamp. The changes correctly use dataclasses.field with a default_factory to generate timestamps. Additionally, you've correctly addressed mutable default arguments for id and files in MockMessage by converting it to a dataclass and using default_factory.

I've added one suggestion to improve maintainability by reducing code duplication for the timestamp generation logic. Overall, this is a good improvement.

Copy link
Member

@xieyxclack xieyxclack left a comment

Choose a reason for hiding this comment

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

LGTM

@xieyxclack xieyxclack merged commit df0776c into agentscope-ai:main Jan 30, 2026
2 checks passed
@xieyxclack xieyxclack linked an issue Jan 30, 2026 that may be closed by this pull request
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.

[Bug]: In Alias, the update time and create time bug in MockSession

2 participants