Skip to content

bug: agent_sync_state.git_dir_bytes is a 32-bit INTEGER on PostgreSQL — .git over 2 GiB breaks the sync-state upsert #2800

Closed

Description

@vybe

Summary

agent_sync_state.git_dir_bytes is declared as a plain Integer for the PostgreSQL backend (src/backend/db/tables.py and Alembic revision 0019_agent_sync_state_git_dir_bytes, which adds INTEGER). On PostgreSQL that is a 32-bit column, so any agent whose workspace .git exceeds 2,147,483,647 bytes (2 GiB) makes the sync-state upsert fail with psycopg2.errors.NumericValueOutOfRange: integer out of range. SQLite is unaffected (its INTEGER is 64-bit), which is why the default backend never shows it.

Context

Found during the 2026-09-14 pre-release run of dev (eb41896, 0.9.5-rc3) by running the unit tier against a disposable PostgreSQL. tests/unit/test_1596_git_sync_observability.py writes 44 GiB and both of its [postgres] legs fail:

  • TestGitBloatAlerts.test_size_crossing_emits_once[postgres]
  • TestGitDirBytesRoundTrip.test_upsert_and_read_git_dir_bytes[postgres]

The defect has been present since the column was added on 2026-07-14 (#1596). CI never sees it: the schema-parity PostgreSQL tier runs only -m requires_postgres, and this test's Postgres leg comes from the db_backend parametrization in tests/db_harness.py, which is not marked. The whole point of git_dir_bytes is to observe bloat (#1596), so the values it exists to record are exactly the ones that overflow.

Acceptance Criteria

  • git_dir_bytes is a 64-bit integer on PostgreSQL: BigInteger in src/backend/db/tables.py, and a new Alembic revision that runs ALTER TABLE agent_sync_state ALTER COLUMN git_dir_bytes TYPE BIGINT (dual-track, Invariant Fix git pushing bug #9: the SQLite migration entry is a recorded no-op since SQLite INTEGER is already 64-bit; src/backend/db/schema.py DDL stays consistent).
  • tests/unit/test_1596_git_sync_observability.py passes on both backends with TEST_POSTGRES_URL set.
  • The Alembic single-head guard (scripts/ci/check_alembic_heads.py) still reports one head.
  • Either the affected tests are marked requires_postgres so the schema-parity PostgreSQL tier runs them, or the tier's selection is widened, so this class cannot regress silently again.

Technical Notes

Activity

  1. added
    priority-p1
    type-bug
    theme-reliability
    complexity-low
    status-ready
    on Sep 15, 2026
  2. removed
    status-ready
    on Sep 15, 2026
  3. self-assigned this
    on Sep 15, 2026
  4. added
    status-in-progress
    on Sep 15, 2026
  5. added 4 commits that reference this issue on Sep 15, 2026
  6. added
    status-in-dev
    and removed
    status-in-progress
    on Sep 16, 2026
  7. removed
    status-in-dev
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-lowpriority-p1theme-reliabilitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions