Agent skill
instance-actors
Managing instance actor orchestrations for PostgreSQL health monitoring. Use when debugging stale actors, restarting actors, or troubleshooting health check issues.
Install this agent skill to your Project
npx add-skill https://github.com/affandar/toygres/tree/main/.agents/skills/instance-actors
SKILL.md
Instance Actor Management
Overview
Instance actors are detached Duroxide orchestrations that run continuously to monitor PostgreSQL instance health. They can become orphaned or stale.
Actor Lifecycle
- Created: When instance is created,
create_instanceorchestration spawns an actor - Running: Actor loops forever: check health → update CMS → timer → continue-as-new
- Cancelled: When instance is deleted, actor is cancelled via
cancel_instance()
Detecting Problems
Stale Actor (running but not working)
last_health_check> 5 minutes old- Actor may be stuck, timer broken, or worker not processing
Missing Actor
instance_actor_orchestration_idis NULL- Or orchestration doesn't exist in duroxide state
Zombie Actor (in DB but not processing)
- Status shows "Running" but no health updates
- Often caused by server crash or DB migration
API Endpoints
# Start new actor
curl -X POST /api/instances/:name/actor/start
# Restart actor (cancel + start new)
curl -X POST /api/instances/:name/actor/restart
# Cancel actor
curl -X POST /api/instances/:name/actor/cancel
Duroxide Client Usage
// Cancel an actor
client.cancel_instance(&actor_id, "User requested cancellation").await?;
// Check if actor exists
match client.get_instance_info(&actor_id).await {
Ok(info) => println!("Status: {}", info.status),
Err(_) => println!("Actor not found"),
}
// Start new actor (detached)
client.start_orchestration(
&new_actor_id,
orchestrations::INSTANCE_ACTOR,
serde_json::to_string(&input)?,
).await?;
Recovery Procedures
Restart All Stale Actors
-- Find instances with stale health
SELECT user_name, k8s_name, last_health_check, instance_actor_orchestration_id
FROM toygres_cms.instances
WHERE state = 'running'
AND (last_health_check IS NULL OR last_health_check < NOW() - INTERVAL '5 minutes');
Then use the UI or API to restart each actor.
After Database Migration
If duroxide state wasn't migrated, all actors are orphaned:
- List all running instances
- For each, call
/api/instances/:name/actor/start
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
database-changes
Making database schema changes to the CMS database. Use when adding columns, tables, running migrations, or updating the backend API and TypeScript types for new database fields.
fullstack-features
Building full-stack features in Toygres from UI to database. Use when adding new features, API endpoints, React components, or implementing end-to-end functionality.
aks-deployment
Deploying and debugging Toygres on AKS (Azure Kubernetes Service). Use when deploying, debugging pods, viewing logs, troubleshooting SSL, or managing Kubernetes resources.
duroxide-orchestration-versioning
Guidance for safely versioning Duroxide orchestrations — file structure, naming conventions, workflow, and registry registration.
image-backup-restore
Implementing and debugging PostgreSQL image backup and restore features. Use when working with database snapshots, backup jobs, restore operations, azcopy blob transfers, or troubleshooting image-related provisioning failures.
duroxide-orchestrations
Writing durable workflows using Duroxide in Rust. Use when creating orchestrations, activities, workflows, or when the user mentions duroxide, durable functions, or workflow orchestration.
Didn't find tool you were looking for?