Repository navigation
Closed
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p1Critical paththeme-reliabilityTheme: Reliabilitytype-featureNew functionality
Description
Summary
New endpoint to adopt latest upstream (main) while preserving agent-specific state files.
Context
Problem P2/P3: When parallel history exists, both UI options ("Pull First" / "Force Push") make things worse. The only valid recovery is: adopt main as baseline, overlay workspace state, push to working branch. Currently requires SSH access.
Acceptance Criteria
New endpoint
-
POST /api/agents/{name}/git/reset-to-main-preserve-state - Backend proxies to agent server
Guardrails
- ALWAYS snapshot persistent-state files to
.trinity/backup/<timestamp>/before reset - Create tar archive downloadable via Files panel
- Refuse if agent has no git config
- Refuse if agent is currently running a task (check activity service)
Agent-server implementation
- New endpoint proxied from backend
- Uses S4's
_reset_preserving_persistent_state()subroutine - Commits "Adopt main baseline, preserve state"
- Pushes with
--force-with-lease
New agent-server primitives
-
POST /api/agent-server/snapshot?paths=...— returns tarball of matched files -
POST /api/agent-server/restore— restore from tarball with path allowlist
Response
{
"success": true,
"files_preserved": ["workspace/decisions.csv", ".trinity/config.yaml", ...],
"commit_sha": "abc123",
"backup_path": ".trinity/backup/2026-04-18T..."
}Technical Notes
Depends on #383 (S4 persistent state allowlist).
Files to modify:
src/backend/routers/git.py— new endpointsrc/backend/services/git_service.py— proxy logicdocker/base-image/agent_server/routers/git.py— implementationdocker/base-image/agent_server/routers/files.py— snapshot/restore primitives
Part of Epic #381
Metadata
Metadata
Assignees
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p1Critical paththeme-reliabilityTheme: Reliabilitytype-featureNew functionality
Activity
feat(git): persistent-state allowlist primitive (S4, Abilityai#383)
feat(frontend/git): parallel-history modal variant + detection
feat(agent-server): snapshot + restore primitives (S3, Abilityai#384)
feat(agent-server): reset-to-main-preserve-state routine (S3, Ability…
feat(backend): reset-to-main-preserve-state endpoint + agent-busy gua…
test(git-sync): pure-git S3 regression script (Abilityai#384)
test(integration): reset-to-main-preserve-state end-to-end (Abilityai…
docs: reset-to-main-preserve-state endpoint + feature-flow entry (Abi…
chore(git-service): drop invalid WPS433 noqa on lazy import (Abilitya…
chore(agent-server): parameterise subprocess & dict generics (Ability…
feat(git): persistent-state allowlist primitive (S4, #383) (#394)
docs(feature-flow): add reset-preserve-state to github-sync entry poi…
docs(feature-flow): reset-preserve-state section in github-sync (Abil…
42 remaining items
refactor(#454): docker exec instead of agent-server HTTP endpoint
refactor(#454): docker exec instead of agent-server HTTP endpoint
refactor(#454): docker exec instead of agent-server HTTP endpoint
refactor(#454): docker exec instead of agent-server HTTP endpoint
feat(scheduler): agent-owned pre-check hook (#454) (#455)
Release: v0.5.0 (#608)
feat(skills): full-directory skill packages + frontmatter contract (a…
fix(review): the ?new=1 deep link, the missing frontend test, and thr…
Release: v0.9.5 (#2872)
fix(skills): the platform never leaves a marker-less directory behind…
fix(skills): refuse to overwrite an agent-authored skill of the same …
feat(schedules): a schedule that names a user runs as that seat — rea…
feat(workspace): the role card in Agent details — role, objectives wi…