Skip to content

Feat/agent provisioning#13

Closed
lwlee2608 wants to merge 5 commits intomainfrom
feat/agent-provisioning
Closed

Feat/agent provisioning#13
lwlee2608 wants to merge 5 commits intomainfrom
feat/agent-provisioning

Conversation

@lwlee2608
Copy link
Member

No description provided.

- Create provisioning_keys table with SHA-256 key hashing and status lifecycle
- Create agents table where id IS the agent identifier (no separate agent_id)
- Create agent_connection_logs table for audit trail
- Add SQLC queries for provisioning keys, agents, and connection logs
- Generate type-safe database access layer via SQLC
- Add provisioning system documentation
@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/agent-provisioning

Comment @coderabbitai help to get the list of available commands and usage tips.

- Add provisioning service with key generation (crypto/rand) and SHA-256 hashing
- Add agent service for lifecycle management and connection logging
- Integrate provisioning handshake into gRPC stream handler
- Support legacy agent auto-migration with default user
- Add database persistence for agent last_seen updates
- Update connection manager to accept agent service for DB persistence
- Wire up services in server initialization
- Update tests to reflect new ConnectionManager signature
- Update documentation with Phase 2 completion status
- Add provisioning key management endpoints (POST/GET/DELETE)
- Add agent management endpoints (GET/DELETE)
- Implement JWT-based authentication for all provisioning endpoints
- Add agent client provisioning handshake logic
- Implement automatic config file persistence after provisioning
- Agent removes provisioning_key and saves agent_id to config
- Add comprehensive manual testing guide in documentation
- Update router to expose new endpoints with authentication
- Wire services into HTTP layer

API Endpoints:
- POST /provisioning-keys - Create provisioning key
- GET /provisioning-keys - List user's keys
- DELETE /provisioning-keys/:id - Revoke key
- GET /agents - List user's agents with connection status
- GET /agents/:id - Get agent details
- DELETE /agents/:id - Deregister agent (soft delete)

Agent Client:
- Accepts provisioning_key in config
- Sends provisioning_key on first connection
- Receives agent_id from server
- Persists agent_id to YAML config
- Removes provisioning_key from config
- Subsequent connections use agent_id
Make IncrementKeyUsage atomic with WHERE used_count < max_uses guard
so concurrent requests cannot exceed max_uses. Reorder ProvisionAgent
to claim a key use before creating the agent.

Remove legacy agent auto-migration since the service has not been
deployed to production — unknown agent_id now returns an error instead
of silently creating agents under the admin user.
@lwlee2608 lwlee2608 closed this Feb 9, 2026
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.

1 participant