Skip to content

Add Agents array to CommittedMetadata for multi-agent checkpoints#98

Merged
Soph merged 1 commit intomainfrom
feat/multi-session-agents-array
Jan 26, 2026
Merged

Add Agents array to CommittedMetadata for multi-agent checkpoints#98
Soph merged 1 commit intomainfrom
feat/multi-session-agents-array

Conversation

@peyton-alt
Copy link
Contributor

@peyton-alt peyton-alt commented Jan 23, 2026

Note

Introduces multi-agent tracking for committed checkpoints while preserving backwards compatibility.

  • Add Agents array to CommittedMetadata; keep Agent as the first agent for compat (single-session omits agents)
  • Update writeMetadataJSON to merge multi-session data: deduplicate/merge agents, session_ids, files_touched, and increment session_count
  • New mergeAgents helper for order-preserving deduplication
  • Add tests: single-session (no agents), multi-session (ordered agents array), and deduplication; plus helper to read metadata from branch

Risk: Low — additive metadata field and merge logic covered by tests; existing reads continue using agent field

Written by Cursor Bugbot for commit b543b3a. This will update automatically on new commits. Configure here.

@peyton-alt peyton-alt requested a review from a team as a code owner January 23, 2026 03:35
Copilot AI review requested due to automatic review settings January 23, 2026 03:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an Agents array field to CommittedMetadata to support tracking multiple agents in multi-session checkpoints. The implementation maintains full backwards compatibility with existing single-agent checkpoints while enabling proper tracking when multiple AI agents collaborate on the same checkpoint.

Changes:

  • Added Agents []string field to CommittedMetadata for tracking all contributing agents in multi-session checkpoints
  • Implemented agent merging logic with deduplication while preserving order
  • Maintained backwards compatibility by keeping the singular Agent field populated with the first agent

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
cmd/entire/cli/checkpoint/checkpoint.go Added Agents field to CommittedMetadata struct with appropriate JSON tag and documentation
cmd/entire/cli/checkpoint/committed.go Implemented agent merging logic in writeMetadataJSON and added mergeAgents helper function
cmd/entire/cli/checkpoint/checkpoint_test.go Added comprehensive test coverage for single-session (no Agents array), multi-session merge (multiple agents), and same-agent deduplication scenarios

@peyton-alt peyton-alt force-pushed the feat/multi-session-agents-array branch from b18efb4 to 07ba5c6 Compare January 23, 2026 04:47
Copilot AI review requested due to automatic review settings January 23, 2026 04:55
@peyton-alt peyton-alt force-pushed the feat/multi-session-agents-array branch from 07ba5c6 to 00fadc8 Compare January 23, 2026 04:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

for i := 1; i <= 2; i++ {
err = store.WriteCommitted(context.Background(), WriteCommittedOptions{
CheckpointID: checkpointID,
SessionID: "session-" + string(rune('0'+i)),
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

The session ID generation using string(rune('0'+i)) is unconventional and could be confusing to readers. While it works correctly for i=1 and i=2 (producing "session-1" and "session-2"), a more idiomatic approach would be using fmt.Sprintf("session-%d", i) or strconv.Itoa(i) for better readability and maintainability.

Copilot uses AI. Check for mistakes.
@peyton-alt peyton-alt force-pushed the feat/multi-session-agents-array branch from 00fadc8 to fee19d0 Compare January 23, 2026 05:02
Copilot AI review requested due to automatic review settings January 23, 2026 21:08
@peyton-alt peyton-alt force-pushed the feat/multi-session-agents-array branch from fee19d0 to 8466902 Compare January 23, 2026 21:08
@peyton-alt peyton-alt force-pushed the feat/multi-session-agents-array branch from 8466902 to b543b3a Compare January 23, 2026 21:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

err := store.WriteCommitted(context.Background(), WriteCommittedOptions{
CheckpointID: checkpointID,
SessionID: "session-" + string(rune('0'+i)),
Strategy: "auto-commit",
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

The session ID generation is incorrect. string(rune('0'+i)) creates a single-character string from a rune, which for i=1 gives '1' and for i=2 gives '2'. This means the session IDs will be "session-1" and "session-2", but if the loop were to iterate beyond i=9, it would produce non-digit characters. A safer approach would be to use string formatting like fmt.Sprintf("session-%d", i) or strconv.Itoa(i).

Copilot uses AI. Check for mistakes.
@Soph Soph merged commit 0bfdeb4 into main Jan 26, 2026
4 checks passed
@Soph Soph deleted the feat/multi-session-agents-array branch January 26, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants