AI Process Objects#90
Conversation
Signed-off-by: jackie <jackieismpc@gmail.com>
a9ff0c5 to
d35d598
Compare
|
@codex review |
|
Claude finished @genedna's task in 2m 9s —— View job Code Review - AI Process Objects ✅SummaryThis PR introduces a well-structured 🔴 Critical Issues1. Panic in Library Code (src/ai_process/base.rs:133)Issue: pub fn new(kind: impl Into<ActorKind>, id: impl Into<String>) -> Self {
let id_str = id.into();
if id_str.trim().is_empty() {
panic!("Actor ID cannot be empty"); // ❌ Panic in library code
}
// ...
}Recommendation: Return pub fn new(kind: impl Into<ActorKind>, id: impl Into<String>) -> Result<Self, String> {
let id_str = id.into();
if id_str.trim().is_empty() {
return Err("Actor ID cannot be empty".to_string());
}
Ok(Self { /* ... */ })
}Impact: High - Can cause unexpected panics in downstream applications 2.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d35d5985e8
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
Introduces a new ai_process module into git-internal that models AI agent run metadata (tasks, runs, patchsets, provenance, etc.) as reusable, Git-native-ish objects, with deterministic checksumming support and build-system wiring for new deps.
Changes:
- Added
src/ai_process/*with base types (Header, refs) and process-layer objects (Task,Run,Plan,PatchSet,ToolInvocation, etc.). - Added deterministic
Checksumimplementation using canonicalized JSON + SHA-256, plus unit tests. - Updated dependencies/build metadata to include
ring,serde_json, anduuidv7 + serde features; added generated BUCK rules for new third-party crates.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| third-party/rust/crates/windows_x86_64_msvc/0.52.6/BUCK | Generated BUCK rule for new windows_* dependency graph (via ring/windows-sys). |
| third-party/rust/crates/windows_x86_64_gnullvm/0.52.6/BUCK | Generated BUCK rule for windows_x86_64_gnullvm. |
| third-party/rust/crates/windows_x86_64_gnu/0.52.6/BUCK | Generated BUCK rule for windows_x86_64_gnu. |
| third-party/rust/crates/windows_i686_msvc/0.52.6/BUCK | Generated BUCK rule for windows_i686_msvc. |
| third-party/rust/crates/windows_i686_gnullvm/0.52.6/BUCK | Generated BUCK rule for windows_i686_gnullvm. |
| third-party/rust/crates/windows_i686_gnu/0.52.6/BUCK | Generated BUCK rule for windows_i686_gnu. |
| third-party/rust/crates/windows_aarch64_msvc/0.52.6/BUCK | Generated BUCK rule for windows_aarch64_msvc. |
| third-party/rust/crates/windows_aarch64_gnullvm/0.52.6/BUCK | Generated BUCK rule for windows_aarch64_gnullvm. |
| third-party/rust/crates/windows-targets/0.52.6/BUCK | Generated BUCK rule for windows-targets. |
| third-party/rust/crates/windows-sys/0.52.0/BUCK | Generated BUCK rule for windows-sys (new transitive dep). |
| third-party/rust/crates/uuid/1.19.0/BUCK | Enables uuid feature v7 in Buck build. |
| third-party/rust/crates/untrusted/0.9.0/BUCK | Generated BUCK rule for untrusted (new transitive dep of ring). |
| third-party/rust/crates/ring/0.17.14/BUCK | Generated BUCK rule for ring (new dependency for checksum hashing). |
| src/lib.rs | Exposes new pub mod ai_process and updates crate docs list. |
| src/ai_process/mod.rs | Declares and re-exports ai_process submodules. |
| src/ai_process/base.rs | Adds core types (Header, ActorRef, ArtifactRef) and related helpers/tests. |
| src/ai_process/checksum.rs | Adds SHA-256 checksum type with deterministic JSON canonicalization + tests. |
| src/ai_process/objects.rs | Adds AI process-layer objects and associated tests. |
| buckal.snap | Updates buckal fingerprint/snapshotted dependency set. |
| Cargo.toml | Adds ring/serde_json, enables uuid features serde + v7. |
| Cargo.lock | Locks new deps: ring, untrusted, windows-sys 0.52.0, windows-targets 0.52.6, etc. |
| BUCK | Adds ring and serde_json to crate’s Buck dependency list. |
| #[serde(flatten)] | ||
| pub header: Header, | ||
| pub task_id: Uuid, | ||
| pub orchestrator_version: String, | ||
| pub base_commit_sha: String, | ||
| pub status: RunStatus, | ||
| pub context_snapshot_id: Option<Uuid>, |
There was a problem hiding this comment.
This module stores Git object IDs as raw String (e.g., base_commit_sha). The rest of the crate uses crate::hash::ObjectHash to support SHA-1/SHA-256 and validate lengths/hex. Consider switching these fields/params to ObjectHash (or a dedicated hash newtype) to avoid accepting invalid IDs and to align with dual-hash support.
| pub run_id: Uuid, | ||
| pub decision_type: String, // commit/checkpoint/abandon/retry/rollback | ||
| pub chosen_patchset_id: Option<Uuid>, | ||
| pub result_commit_sha: Option<String>, | ||
| pub checkpoint_id: Option<String>, | ||
| pub rationale: Option<String>, |
There was a problem hiding this comment.
This module stores Git commit IDs as String (result_commit_sha). Consider using crate::hash::ObjectHash (or another validated hash type) to prevent invalid values and to align with the crate’s SHA-1/SHA-256 support.
| pub struct ContextSnapshot { | ||
| #[serde(flatten)] | ||
| pub header: Header, | ||
| pub base_commit_sha: String, | ||
| pub selection_strategy: String, // explicit/heuristic | ||
| #[serde(default)] |
There was a problem hiding this comment.
This module stores commit IDs as raw String (ContextSnapshot.base_commit_sha). Consider using crate::hash::ObjectHash to validate SHA-1/SHA-256 lengths and keep consistency with the rest of the crate’s hash handling.
|
对象的结构放到 internal/object 下,哈希的方案采用相同的方案,实现相同的 Trait |
Signed-off-by: jackie <jackieismpc@gmail.com>
Signed-off-by: jackie <jackieismpc@gmail.com>
Signed-off-by: jackie <jackieismpc@gmail.com>
Signed-off-by: jackie <jackieismpc@gmail.com>
Signed-off-by: jackie <jackieismpc@gmail.com>
Signed-off-by: jackie <jackieismpc@gmail.com>
Signed-off-by: jackie <jackieismpc@gmail.com>
|
Claude finished @genedna's task in 2m 21s —— View job Code Review - AI Process Objects Implementation
OverviewThis PR successfully introduces AI process objects into 🔴 Critical Issues1. Architectural Mismatch: AI Objects Don't Follow Git Object ModelLocation: Issue: The AI process objects are placed under
Current AI objects:
Recommendation:
Evidence from CLAUDE.md: The architecture overview shows 2. Inconsistent Hash Usage PatternLocations:
Issue: The module creates its own hashing functions ( // In checksum.rs
pub fn compute_hash(content: &[u8]) -> ObjectHash {
ObjectHash::new(content) // Why not call ObjectHash::new directly?
}Problems:
Recommendation:
3. Header.checksum Field Type MismatchLocation: Issue:
pub struct Header {
// ...
#[serde(default)]
checksum: Option<ObjectHash>, // ❌ Wrong type for this use case
}Example of the confusion: In Recommendation:
4. Missing Error Propagation from SerializationLocation: Issue: Status: ✅ This has been fixed in the latest code. Good work!
|
Signed-off-by: jackie <jackieismpc@gmail.com>
Signed-off-by: jackie <jackieismpc@gmail.com>
Signed-off-by: jackie <jackieismpc@gmail.com>
Signed-off-by: jackie <jackieismpc@gmail.com>
|
@jackieismpc ,文件名不需要加 ai_ 这个前缀,只需要按照对象名来命名就行 |
Signed-off-by: jackie <jackieismpc@gmail.com>
|
已修复 |
* add ai_obj and update buck Signed-off-by: jackie <jackieismpc@gmail.com> * refactor project and fix some bugs Signed-off-by: jackie <jackieismpc@gmail.com> * restore hash Signed-off-by: jackie <jackieismpc@gmail.com> * update checksum Signed-off-by: jackie <jackieismpc@gmail.com> * update base object Signed-off-by: jackie <jackieismpc@gmail.com> * update process object Signed-off-by: jackie <jackieismpc@gmail.com> * update doc Signed-off-by: jackie <jackieismpc@gmail.com> * update seal Signed-off-by: jackie <jackieismpc@gmail.com> * refactor base Signed-off-by: jackie <jackieismpc@gmail.com> * update ai_hash Signed-off-by: jackie <jackieismpc@gmail.com> * splite objects Signed-off-by: jackie <jackieismpc@gmail.com> * update docs Signed-off-by: jackie <jackieismpc@gmail.com> * rename objects Signed-off-by: jackie <jackieismpc@gmail.com> --------- Signed-off-by: jackie <jackieismpc@gmail.com>
Summary
Introduce Git-native AI Agent process objects for version management, and add them into
git-internalfor reuse across projects.Implementation
ai_processmodule with base and process-layer objects and exported it from the crate root.Header,ActorRef,ArtifactRef, andChecksum.Task,Run,ContextSnapshot,Plan,PatchSet,Evidence,ToolInvocation,Provenance,Decision.Checksumdeterministic by canonicalizing JSON before hashing, ensuring stable checksums forHashMapfields.serdedefault forToolInvocation.artifactsto allow missing fields on deserialize.ai_process.ringandserde_jsondependencies.uuidfeaturesserdeandv7.Testing
HashMapordering.ToolInvocation.artifacts.cargo test ... ai_processfor module verification.cargo clippy ... -D warnings.新增ai版本管理内置对象 #88