Skip to content

Fleet sync audit endpoint (S6) #390

Closed

Description

@vybe

Summary

New endpoint to get sync status of all agents at once for fleet-level health checks.

Context

Currently, checking sync health requires querying each agent individually. Operators and the `/trinity:sync` skill need a bulk audit capability.

Acceptance Criteria

New endpoint

  • `GET /api/fleet/sync-audit`
  • Returns table of all agents with:
    • `agent_name`
    • `branch` (working branch)
    • `last_pushed_sha`
    • `last_pushed_at`
    • `local_head_sha`
    • `unpushed_commits` (count)
    • `dirty_tree` (boolean)
    • `duplicate_binding` (boolean) — detects P5 at fleet level

Duplicate binding detection

  • Query:
    ```sql
    SELECT github_repo, working_branch, COUNT()
    FROM agent_git_config WHERE source_mode = 0
    GROUP BY github_repo, working_branch HAVING COUNT(
    ) > 1
    ```
  • Flag affected agents in response

Response format

```json
{
"agents": [
{
"name": "my-agent",
"branch": "trinity/my-agent/abc123",
"last_pushed_sha": "def456",
"last_pushed_at": "2026-04-17T10:00:00Z",
"local_head_sha": "def456",
"unpushed_commits": 0,
"dirty_tree": false,
"duplicate_binding": false
}
],
"summary": {
"total": 10,
"in_sync": 8,
"ahead": 1,
"dirty": 1,
"duplicate_bindings": 0
}
}
```

Technical Notes

Files to modify:

  • `src/backend/routers/git.py` — new endpoint
  • `src/backend/services/git_service.py` — aggregation logic

Most data already computable per-agent via existing status endpoint; this batches the queries.

Part of Epic #381

Activity

  1. added
    priority-p3
    type-feature
    on Apr 18, 2026
  2. 4 remaining items

  3. added
    complexity-low
    theme-reliability
    on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-lowpriority-p3theme-reliabilitytype-feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions