Repository navigation
Closed
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p1Critical paththeme-reliabilityTheme: Reliabilitytype-featureNew functionality
Description
Summary
Add a persistent_state allowlist to each agent's config so template-level resets preserve instance-specific files.
Context
Problem P3: To recover from parallel-history deadlock (P2), operators must SSH into the agent and manually run git reset + file restoration. There's no first-class API for "reset to main, but keep my workspace data."
Key insight: template.yaml is only read at agent creation (services/template_service.py:177-200). Sync and reset paths don't re-read it. The allowlist must be materialized to .trinity/persistent-state.yaml at creation time.
Acceptance Criteria
- Template provides default
persistent_statelist intemplate.yaml - At agent creation, write
.trinity/persistent-state.yamlto container - Sync/reset operations read from
.trinity/persistent-state.yaml - Operators can edit the file directly to adjust per-agent
Default allowlist
persistent_state:
- workspace/**
- .trinity/**
- memory/**
- .mcp.json
- .claude.jsonBackend implementation
- Add
_persistent_state_for(agent_name) -> list[str]helper togit_service.py - Read from
.trinity/persistent-state.yaml, fall back to sensible default
Agent-server implementation
- New subroutine
_reset_preserving_persistent_state(target_ref):- Capture matching files to tmp dir
- Run
git reset --hard <target> - Overlay files back
- Commit "Adopt baseline, preserve state"
Agent creation
-
services/agent_service/crud.pywrites.trinity/persistent-state.yamlfrom template'spersistent_statekey
Technical Notes
Files to modify:
src/backend/services/git_service.py— new helperdocker/base-image/agent_server/routers/git.py— reset subroutinesrc/backend/services/agent_service/crud.py— write file on creation
This is the keystone for S3 (reset-preserve-state operation).
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(agent-server): reset-to-main-preserve-state routine (S3, Ability…
feat(git): persistent-state allowlist primitive (S4, #383) (#394)
docs(feature-flows): add persistent-state-allowlist flow (S4, Ability…
docs: record persistent-state allowlist in architecture / requirement…
docs(feature-flows): add persistent-state-allowlist flow (S4, Ability…
docs: record persistent-state allowlist in architecture / requirement…
docs(feature-flows): add persistent-state-allowlist flow (S4, Ability…
docs: record persistent-state allowlist in architecture / requirement…
feat(agent-server): reset-to-main-preserve-state routine (S3, Ability…
docs(memory): persistent-state allowlist flow + architecture/requirem…
feat(agent-server): reset-to-main-preserve-state routine (S3, Ability…
feat(git): reset-to-main-preserve-state operation (S3, #384) (#400)
feat(templates): materialize a template's declared schedules: at agen…
refactor(agents): decompose create_agent_internal behind a characteri…