Skip to content

fix(message): preserve event timestamps and validate rules - #53

Open
rayrayraykk wants to merge 1 commit into
agentscope-ai:mainfrom
rayrayraykk:fix/message-contract-review
Open

rayrayraykk wants to merge 1 commit into
agentscope-ai:mainfrom
rayrayraykk:fix/message-contract-review

Conversation

@rayrayraykk

Copy link
Copy Markdown
Member

Linked Issues

Description

The review of #52 identified three regressions in message event handling and wire validation. This PR fixes only those findings:

  • Preserve each event's created_at when reconstructing content blocks, including nested tool-result blocks. This restores deterministic replay of delayed streams.
  • Validate ToolCallBlock.suggested_rules as permission rules instead of accepting arbitrary values from serialized payloads.
  • Clone usage before the Desktop React state updater applies a MODEL_CALL_END event, so repeated updater calls do not mutate or double-count the previous state.

The existing streaming test now keeps its clock fixed while replaying events, and a focused parser test covers valid and invalid permission rules. No new public API, dependency, generated artifact, or development document is added to the repository.

Verification:

pnpm --filter @agentscope-ai/agentscope build
pnpm --filter @agentscope-ai/agentscope exec jest --runInBand --silent
pnpm build:desktop

Core: 19 suites, 129 tests passed. The Core ESM/CJS/declaration build and Desktop typecheck/build passed. Changed files passed ESLint, Prettier, and git diff --check. A local double-invocation check confirmed the Desktop updater leaves the previous usage object unchanged.

Checklist

  • This PR is linked to a related issue (see above)
  • Code has been formatted with the repository's Prettier and ESLint hooks
  • Related documentation has been updated (not applicable: bug fix with no public API change)
  • All tests are passing (pnpm test equivalent shown above)
  • Code is ready for review

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