MF-4: Per-repo forge binding in config/agents.json + adapter factory #295
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#295
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As an operator, I want to declare each repo's forge in
config/agents.jsonso that agents pick the correctForgePortadapter automatically and startup fails fast when a required token is missing.This is the one hard gate for the multi-forge spec — every other story consumes it.
Acceptance criteria
Config schema
repos[]grows aforgefield:"charles/claude-hooks"resolves toforge: "forgejo".Per-type tokens become forge-scoped
token_filesmap:token_fileis still accepted and resolves asforgejoonly — logged with a deprecation hint pointing attoken_files.Adapter factory
apps/server/src/infrastructure/forge/adapter-factory.tsthat returns the rightForgePortfor a given repo.apps/server/src/shared/config/webhook-config.tswhen buildingResolvedAgent, and byapps/server/src/domain/agent/agent-runner.tswhen building the container env (FORGE_TYPE=..., per-forge token path).Startup validator
config/agents.jsonvalidator: everyrepos[].forgemust have a matchingtoken_files[<forge>]on every agent type that usesforgejo_user-style identity (i.e., every type that opens PRs / issues).Tests
webhook-config.test.ts: mixed-forge config loads, per-repoforgeis resolvable, missing token per forge fails startup with the expected message.token_fileentry still resolves.Out of scope
agentstable. Stays type-level.References
specs/multi-forge.md§ MF-4.apps/server/src/shared/config/webhook-config.ts—ResolvedAgentconstruction.apps/server/src/domain/agent/agent-runner.ts— container env wiring.apps/server/src/infrastructure/database/db.ts—agentstable.Dependencies