Skip to content

fix(agent-core-v2): validate goal records - #1694

Merged
chengluyu merged 1 commit into
mainfrom
agent/goal-v2-08-wire-validation
Jul 15, 2026
Merged

fix(agent-core-v2): validate goal records#1694
chengluyu merged 1 commit into
mainfrom
agent/goal-v2-08-wire-validation

Conversation

@chengluyu

Copy link
Copy Markdown
Collaborator

Related Issue

No related issue. This is a focused fix for session recovery when persisted goal records are malformed.

Problem

Goal replay declared schemas but did not apply them at the wire boundary. Invalid goal enums, malformed structures, or negative and non-finite counters could reach the restored goal model and make recovery unreliable.

What changed

Validate persisted record structure and operation payloads before replay. Goal create and update records now use strict runtime schemas for lifecycle enums, actors, counters, and budgets. Invalid records are reported through the existing recovery error path and skipped; valid older records that omit optional fields remain compatible.

Boundary

The change only validates replay input. It does not change live goal lifecycle behavior, wire persistence format, or the generic wire design beyond applying each operation's existing schema at the replay boundary.

Validation

  • pnpm --filter @moonshot-ai/agent-core-v2 exec vitest run test/agent/goal test/wire
  • pnpm --filter @moonshot-ai/agent-core-v2 test
  • pnpm --filter @moonshot-ai/agent-core-v2 typecheck
  • pnpm --filter @moonshot-ai/agent-core-v2 lint:domain
  • pnpm changeset status

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update. This recovery-only fix does not change documented user workflows.

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2c908b4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@2c908b4
npx https://pkg.pr.new/@moonshot-ai/kimi-code@2c908b4

commit: 2c908b4

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa3c4bfa98

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/agent-core-v2/src/agent/goal/goalOps.ts Outdated

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0f85765a5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/agent-core-v2/src/agent/goal/goalOps.ts Outdated

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dff7e92ae5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/agent-core-v2/src/agent/goal/goalOps.ts Outdated

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 402acf1730

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chengluyu
chengluyu force-pushed the agent/goal-v2-08-wire-validation branch from 402acf1 to 29f4d89 Compare July 14, 2026 19:29
@chengluyu
chengluyu force-pushed the agent/goal-v2-08-wire-validation branch from 29f4d89 to 2c908b4 Compare July 15, 2026 06:15
@chengluyu
chengluyu merged commit 513f374 into main Jul 15, 2026
14 checks passed
@chengluyu
chengluyu deleted the agent/goal-v2-08-wire-validation branch July 15, 2026 06:19
@github-actions github-actions Bot mentioned this pull request Jul 15, 2026
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