Fix orchestrator implementation-swarm allowlist and add agent onboarding#938
Conversation
…merge allowlist The auto-merge author gate hardcoded claude-code/root/adf-* as the only recognised fleet logins, so every PR opened by the implementation-swarm agent was rejected with "not a recognised agent; human-authored PRs require manual merge" on every reconcile tick. This left 11 PRs stuck across terraphim-agents, terraphim-clients, terraphim-config-persistence, and terraphim-core. Move the allowlist to a KG markdown concept (crates/terraphim_orchestrator/kg/recognised_agents.md, synonyms:: line) following this repo's existing KG-driven-config convention, loaded via the new agent_allowlist_kg module. Operators can extend the allowlist by editing that file (or the ADF_RECOGNISED_AGENTS_KG-pointed deployed copy) without a rebuild. pr_review.rs stays I/O-free per its module contract; only the new loader module touches the filesystem. Also fixes an unrelated pre-existing terraphim_workspace test failure on macOS: path_inside_root_is_accepted joined against the raw tempdir path instead of the manager's canonicalised root, so it failed under the /var -> /private/var symlink.
Documentation PreviewYour documentation changes have been deployed to: This preview will be available until the PR is closed. |
AlexMikhalev
left a comment
There was a problem hiding this comment.
Summary
This PR updates ADF auto-merge author recognition to use a KG-backed recognised-agent allowlist, records the remediation/provenance plan, and adds an AI-agent onboarding quickstart to the public documentation.
- KG-backed allowlist:
agent_allowlist_kgloads recognised fleet logins fromrecognised_agents.md, with an environment override and embedded fallback. - Auto-merge policy wiring:
poll_pending_reviewsnow injects the loaded allowlist intoAutoMergeCriteria, whilepr_reviewkeeps policy evaluation pure and I/O-free. - Documentation: the ADF remediation artefacts and onboarding quickstart make the operational workflow and agent handoff expectations clearer.
The architecture is generally sound: the filesystem boundary is isolated in one loader module, the policy functions remain pure, and the new documentation is discoverable from both README and mdBook summary. The main issue is test drift: one gate-evaluation test still checks the pre-change orchestrator.toml guidance, so the PR as submitted can fail when that test is exercised.
Confidence Score: 3/5
- Safe to merge with caution after fixing the stale test assertion.
- I found 1 P1 correctness/CI issue and no P0 issues. The implementation direction is clean, but the stale assertion directly contradicts the new allowlist location and should be fixed before merge.
- Files requiring attention:
crates/terraphim_orchestrator/src/pr_poller.rs.
Important Files Changed
| Filename | Overview |
|---|---|
crates/terraphim_orchestrator/src/agent_allowlist_kg.rs |
New KG loader for recognised agent logins. The I/O boundary is isolated and parsing is unit-tested. |
crates/terraphim_orchestrator/kg/recognised_agents.md |
New KG concept backing the allowlist. Contains the intended implementation-swarm entry. |
crates/terraphim_orchestrator/src/pr_review.rs |
Extends auto-merge criteria with a caller-provided recognised-login set and keeps author policy pure. No issue found. |
crates/terraphim_orchestrator/src/pr_poller.rs |
Evaluates PR gates using the shared author-rejection helper, but one test still expects the old config-file hint. Needs attention. |
crates/terraphim_orchestrator/src/auto_merge_impl.rs |
Loads the KG allowlist once per pending-review poll and passes it into gate evaluation. No issue found. |
crates/terraphim_workspace/src/lib.rs |
Adjusts the path-inside-root test to use the canonicalised manager root. No issue found. |
docs/src/howto/ai-agent-onboarding-quickstart.md |
Adds practical onboarding guidance for AI agents, including search, Gitea, quality gates, and release checks. No issue found. |
README.md / docs/src/SUMMARY.md |
Link the new onboarding guide from top-level and mdBook navigation. No issue found. |
Diagram
%%{init: {"theme": "neutral"}}%%
flowchart TD
A[Reconcile tick] --> B[poll_pending_reviews]
B --> C[load_recognised_agents]
C --> D{ADF_RECOGNISED_AGENTS_KG or kg/recognised_agents.md readable?}
D -->|yes| E[Parse synonyms:: logins]
D -->|no| F[Use embedded recognised_agents.md]
E --> G[AutoMergeCriteria.recognised_agent_logins]
F --> G
G --> H[evaluate_pr_gates]
H --> I{PR author recognised or adf- prefix?}
I -->|yes| J[Continue status and gate-result checks]
I -->|no| K[HumanReviewNeeded with allowlist hint]
J --> L{All required contexts and gate results pass?}
L -->|yes| M[Enqueue AutoMerge]
L -->|no| N[Awaiting/Stale/Human review outcome]
C:::new
E:::new
G:::new
classDef new fill:#d4edda,stroke:#28a745;
Inline Findings
P1 crates/terraphim_orchestrator/src/pr_poller.rs, line 730: Stale assertion still expects the old allowlist location
The implementation intentionally moved the operator hint from orchestrator.toml to the KG allowlist file via agent_author_rejection_reason, which now says to add the login to crates/terraphim_orchestrator/kg/recognised_agents.md. This test still asserts that the reason contains orchestrator.toml, so it no longer matches the production behaviour introduced by this PR.
Consequence: the gate-evaluation test will fail when run, and it also documents the wrong remediation path for operators. Update the assertion to match the new KG-backed allowlist location, for example:
assert!(
reason.contains("kg/recognised_agents.md"),
"reason must point to the KG allowlist file, got: {reason}"
);Comments Outside Diff (0)
Last reviewed commit: 92c2f82 | Reviews (1)
|
Addressed the structural review finding in 58ad974. The stale test assertion now checks for , matching the KG-backed allowlist hint emitted by . Also applied rustfmt formatting in the same file. Validation:
Note: direct focused cargo commands for remain awkward in this checkout because the crate is not an active workspace member and package resolution is ambiguous without the hook-driven workspace path. |
Documentation PreviewYour documentation changes have been deployed to: This preview will be available until the PR is closed. |
|
Correction to the previous validation note: addressed the structural review finding in commit 58ad974. The stale pr_poller.rs test assertion now checks for kg/recognised_agents.md, matching the KG-backed allowlist hint emitted by agent_author_rejection_reason. Also applied rustfmt formatting in the same file. Validation:
Note: direct focused cargo commands for terraphim_orchestrator remain awkward in this checkout because the crate is not an active workspace member and package resolution is ambiguous without the hook-driven workspace path. |
Summary
Validation
Notes