Skip to content

feat(settings): auto-propagate GitHub PAT to running agents (#211)#402

Merged
vybe merged 2 commits into
Abilityai:mainfrom
AndriiPasternak31:AndriiPasternak31/issue-211
Apr 19, 2026
Merged

feat(settings): auto-propagate GitHub PAT to running agents (#211)#402
vybe merged 2 commits into
Abilityai:mainfrom
AndriiPasternak31:AndriiPasternak31/issue-211

Conversation

@AndriiPasternak31
Copy link
Copy Markdown
Contributor

Summary

  • Auto-propagates the global GitHub PAT to all running agents' .env when it is updated in Settings, so agents pick up the new token without a restart.
  • Skips agents that already have a per-agent PAT (feat: Per-agent GitHub PAT configuration #347) and agents whose .env does not currently contain GITHUB_PAT. DELETE does NOT propagate.
  • Reuses existing agent-side /api/credentials/read and /api/credentials/inject endpoints — no new agent-server surface.

Changes

  • src/backend/services/github_pat_propagation_service.py — new service; reads each target agent's .env, patches the GITHUB_PAT line (preserving all other keys and the agent's own escaping format), and writes it back. Runs concurrently via asyncio.gather with per-agent error isolation.
  • src/backend/routers/settings.pyupdate_github_pat now calls the propagation service after db.set_setting(...) and returns the per-agent status. Propagation failures are caught and reported in the response so the PAT save is never rolled back.
  • src/backend/models.py — adds AgentPropagationStatus and GithubPatPropagationResult Pydantic models.
  • src/frontend/src/views/Settings.vue — renders the propagation result below the PAT status line (success count, failed list, skipped reasons).
  • tests/test_github_pat_propagation_unit.py — 11 unit tests covering env patching, per-agent PAT skip, no-PAT-in-env skip, stopped-agent skip, merge preserves other keys, partial-failure isolation.
  • docs/memory/feature-flows/platform-settings.md — documents the auto-propagation behavior.

Acceptance Criteria

  • Updating GitHub PAT automatically propagates to all active agents with GITHUB_PAT
  • Response includes per-agent propagation status
  • Frontend shows propagation results (success count, any failures)
  • Partial failures don't block the PAT update itself
  • Delete PAT does NOT propagate

Test Plan

  • python -m pytest tests/test_github_pat_propagation_unit.py -v (11/11 pass)
  • Manual E2E: three agents — one stopped, one with per-agent PAT, one with global GITHUB_PAT injected. Update global PAT via Settings UI → only the third has .env updated; UI shows "PAT updated and applied to 1 of 1 running agents".

Closes #211

🤖 Generated with Claude Code

Andrii Pasternak and others added 2 commits April 19, 2026 00:49
…i#211)

When the global GitHub PAT is updated in Settings, push the new value into
each running agent's .env so agents pick it up without a restart. Reuses
the existing agent-side /api/credentials/read + /api/credentials/inject
endpoints — no new agent-server routes. Per-agent PATs (Abilityai#347) and agents
that never had GITHUB_PAT in .env are skipped. Delete PAT does NOT
propagate. Partial failures are reported per agent and never block the
PAT save.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a Global PAT Auto-Propagation section to github-sync.md covering
eligibility rules, the read-modify-inject mechanism, response shape, and
delete non-propagation. Updates feature-flows index and project_index.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@vybe vybe left a comment

Choose a reason for hiding this comment

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

Approved via /validate-pr — docs, tests, security all clean.

@vybe vybe merged commit aa830dc into Abilityai:main Apr 19, 2026
@AndriiPasternak31 AndriiPasternak31 deleted the AndriiPasternak31/issue-211 branch April 25, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Auto-propagate GitHub PAT to all agents on update

2 participants