fix(agent-core-v2): validate goal records - #1694
Conversation
🦋 Changeset detectedLatest commit: 2c908b4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
402acf1 to
29f4d89
Compare
29f4d89 to
2c908b4
Compare
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/wirepnpm --filter @moonshot-ai/agent-core-v2 testpnpm --filter @moonshot-ai/agent-core-v2 typecheckpnpm --filter @moonshot-ai/agent-core-v2 lint:domainpnpm changeset statusChecklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update. This recovery-only fix does not change documented user workflows.