refactor(agents): remove needsGitHubToken from agent definitions#609
refactor(agents): remove needsGitHubToken from agent definitions#609zbigniewsobiecki merged 1 commit intodevfrom
Conversation
|
✨ On it — checking the PR changes now Progress: [█░░░░░░░░░] 6% (iteration 4/70) 🔍 Code Review Update (1 min) I've started my review by examining the Last updated: iteration 4 · review |
nhopeatall
left a comment
There was a problem hiding this comment.
LGTM — Clean removal of a redundant field with correct derivation logic.
I verified all 10 YAML agents: every old needsGitHubToken value (5× true, 5× false) matches what requiresScmIntegration() now derives from integrations.required. The fallback path through deriveRequiredIntegrations() is a sensible safety net for definitions without explicit integrations.
Key things confirmed:
- Backward compatibility:
z.boolean().optional()inBackendSchemakeeps existing DB JSONB blobs parsing cleanly — no migration needed. - Runtime contract preserved:
AgentProfile.needsGitHubTokenstays on the interface;adapter.tsandsecretBuilder.tscontinue consuming it unchanged. - Test updates are correct:
loader.test.tsassertions properly shifted fromdef.backend.needsGitHubTokentodef.integrations?.requiredchecks. Test fixtures in other files correctly drop the now-optional field. - Frontend editor cleanup: Removing the "Needs GitHub Token" toggle makes sense since the value is now derived and shouldn't be manually overridden.
- All CI checks pass (lint, unit tests, integration tests).
nhopeatall
left a comment
There was a problem hiding this comment.
LGTM — verified all 10 YAML agents produce identical needsGitHubToken values through derivation. Clean refactoring with correct backward compatibility.
Summary
Removes the redundant
needsGitHubTokenfield from all built-in agent YAML definitions and theBackendSchema. GitHub token access is now automatically derived from whetherscmappears inintegrations.required.Closes: https://trello.com/c/69a59d518718debdf3ea7056
Changes
src/agents/definitions/schema.ts: ChangedneedsGitHubToken: z.boolean()toz.boolean().optional()inBackendSchemafor backward compatibility (existing DB blobs with the field will still parse without errors; the field is ignored at runtime)src/agents/definitions/profiles.ts: AddedrequiresScmIntegration(def)helper that checksdef.integrations?.required.includes('scm')with capability-derived fallback; updatedbuildProfileFromDefinitionto use it instead of readingdef.backend.needsGitHubTokenneedsGitHubTokenline; five YAMLs that had barebackend: nullwere updated tobackend: {}web/src/components/settings/agent-definition-editor.tsx: Removed the "Needs GitHub Token" toggle from the Backend Settings section and theneedsGitHubToken: falsedefaultneedsGitHubTokenfromAgentDefinitionfixtures; updatedloader.test.tsassertions to checkdef.integrations?.requiredinstead ofdef.backend.needsGitHubTokenKey Decisions
AgentProfile.needsGitHubToken: booleanstays on the interface —adapter.tsandsecretBuilder.tsread it at runtime. Only the source of truth moves from the YAML to derivation logic.optional()ensures no DB migration is needed — existing JSONB blobs with the field will parse correctly.requiresScmIntegration()checks explicitintegrations.requiredfirst, then falls back to capability-derived integrations.Test Plan
🤖 Generated with Claude Code