Skip to content

docs: migrate resilience recipes to service model#11

Open
guoqqqi wants to merge 3 commits intomasterfrom
codex/recipe-service-model-resilience
Open

docs: migrate resilience recipes to service model#11
guoqqqi wants to merge 3 commits intomasterfrom
codex/recipe-service-model-resilience

Conversation

@guoqqqi
Copy link
Copy Markdown
Contributor

@guoqqqi guoqqqi commented Apr 28, 2026

Summary

  • Migrate health-check and circuit-breaker recipes away from standalone a7 upstream resources.
  • Define health checks on service upstreams and attach routes using service_id.
  • Update circuit-breaker examples to create services first and apply api-breaker on service-backed routes.
  • Update Config Sync examples to use services and route paths / service_id.

Validation

  • make validate-skills
  • make test-skills
  • git diff --check

Copilot AI review requested due to automatic review settings April 28, 2026 17:00
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

Warning

Rate limit exceeded

@guoqqqi has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 58 minutes and 50 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b2e36c80-dfe8-4a5d-a97f-4d8afeb81d4d

📥 Commits

Reviewing files that changed from the base of the PR and between 024dacd and 31865fd.

📒 Files selected for processing (2)
  • skills/a7-recipe-circuit-breaker/SKILL.md
  • skills/a7-recipe-health-check/SKILL.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/recipe-service-model-resilience

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 58 minutes and 50 seconds.

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the “health check” and “circuit breaker” recipe skills to reflect the current API7 EE runtime model: define upstream + health checks on services, and bind traffic via service-backed routes (service_id), including updated Config Sync examples.

Changes:

  • Migrates health-check recipe examples from standalone upstreams to a7 service create + a7 route create with service_id.
  • Updates circuit-breaker recipe examples to create a service first and apply api-breaker on a service-backed route.
  • Updates declarative (Config Sync) YAML examples to use services + route paths/service_id.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
skills/a7-recipe-health-check/SKILL.md Rewrites examples and Config Sync to use service-owned upstream health checks and service-backed routes.
skills/a7-recipe-circuit-breaker/SKILL.md Reworks circuit breaker workflow to create services first and attach api-breaker to service-backed routes; updates Config Sync accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +117 to +123
### 3. Passive health check

```bash
# Current a7 does not expose a standalone upstream-health command.
# Verify the upstream/route wiring and use gateway observability for node state.
a7 upstream get backend --gateway-group default --output json
a7 route list --gateway-group default --output json
```

## Common Patterns

### TCP health check (non-HTTP services)

```json
a7 service create --gateway-group default -f - <<'EOF'
{
"checks": {
"active": {
"type": "tcp",
"healthy": {
"interval": 5,
"successes": 2
},
"unhealthy": {
"interval": 2,
"tcp_failures": 3,
"timeouts": 2
"id": "backend-passive-service",
"name": "backend-passive-service",
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The passive health check example creates backend-passive-service but never attaches a route to it. Because passive checks only evaluate real traffic and health checks generally only run when a service is referenced by at least one route, this example won’t actually demonstrate passive checking unless you also create a route (and send requests) for this service.

Copilot uses AI. Check for mistakes.
Comment on lines +152 to +158
### 4. Combined active + passive checks

```json
```bash
a7 service create --gateway-group default -f - <<'EOF'
{
"checks": {
"active": {
"type": "http",
"http_path": "/internal/health",
"host": "health.internal",
"req_headers": [
"Authorization: Bearer health-check-token",
"X-Health-Check: true"
],
"healthy": {
"interval": 10,
"successes": 2
"id": "production-backend-service",
"name": "production-backend-service",
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The combined active+passive service (production-backend-service) is created but no runtime route is created/updated to reference it in the step-by-step flow. Since the Troubleshooting section notes health checks won’t run without a referencing route, consider adding a a7 route create (or updating the earlier route) to bind service_id: production-backend-service so the example is runnable end-to-end.

Copilot uses AI. Check for mistakes.
Comment thread skills/a7-recipe-health-check/SKILL.md Outdated
| All nodes marked unhealthy | Health endpoint returns wrong status code | Verify `http_statuses` includes your health endpoint's response code |
| Node not recovering | Passive-only: no traffic reaches unhealthy node | Add active health checks for recovery |
| Probe hitting wrong endpoint | Default `http_path` is `/` | Set `http_path` to your actual health endpoint |
| Health checks not running | Route does not reference the service | Verify `service_id` with `a7 route get` |
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Troubleshooting table suggests verifying service_id with a7 route get, but this recipe otherwise uses a7 route list --service-id ... and doesn’t show route get usage. Consider switching this to a7 route list --service-id <service> (or add the route get example/command to keep the guidance consistent).

Suggested change
| Health checks not running | Route does not reference the service | Verify `service_id` with `a7 route get` |
| Health checks not running | Route does not reference the service | Verify `service_id` with `a7 route list --service-id <service>` |

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings April 29, 2026 13:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +117 to 147
### 3. Passive health check

```bash
# Current a7 does not expose a standalone upstream-health command.
# Verify the upstream/route wiring and use gateway observability for node state.
a7 upstream get backend --gateway-group default --output json
a7 route list --gateway-group default --output json
```

## Common Patterns

### TCP health check (non-HTTP services)

```json
a7 service create --gateway-group default -f - <<'EOF'
{
"checks": {
"active": {
"type": "tcp",
"healthy": {
"interval": 5,
"successes": 2
},
"unhealthy": {
"interval": 2,
"tcp_failures": 3,
"timeouts": 2
"id": "backend-passive-service",
"name": "backend-passive-service",
"upstream": {
"type": "roundrobin",
"nodes": [
{"host": "backend-1", "port": 8080, "weight": 1},
{"host": "backend-2", "port": 8080, "weight": 1}
],
"checks": {
"passive": {
"type": "http",
"unhealthy": {
"http_failures": 3,
"http_statuses": [500, 502, 503],
"timeouts": 3
},
"healthy": {
"successes": 5,
"http_statuses": [200, 201, 202, 203, 204]
}
}
}
}
}
EOF
```
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The passive health check example creates backend-passive-service but never creates/updates any route that references this service. In API7 EE, passive checks only observe real traffic on routes bound to the service, so as written the check won’t run or won’t see any responses. Add a route (or an update to an existing route) that uses service_id: backend-passive-service, and mention generating traffic to exercise passive checks.

Copilot uses AI. Check for mistakes.
Comment on lines +152 to 198
### 4. Combined active + passive checks

```json
```bash
a7 service create --gateway-group default -f - <<'EOF'
{
"checks": {
"active": {
"type": "http",
"http_path": "/internal/health",
"host": "health.internal",
"req_headers": [
"Authorization: Bearer health-check-token",
"X-Health-Check: true"
],
"healthy": {
"interval": 10,
"successes": 2
"id": "production-backend-service",
"name": "production-backend-service",
"upstream": {
"type": "roundrobin",
"nodes": [
{"host": "backend-1", "port": 8080, "weight": 1},
{"host": "backend-2", "port": 8080, "weight": 1},
{"host": "backend-3", "port": 8080, "weight": 1}
],
"checks": {
"active": {
"type": "http",
"http_path": "/health",
"healthy": {
"interval": 5,
"successes": 2,
"http_statuses": [200]
},
"unhealthy": {
"interval": 2,
"http_failures": 3,
"timeouts": 2,
"http_statuses": [500, 502, 503, 504]
}
},
"unhealthy": {
"interval": 5,
"http_failures": 3
"passive": {
"type": "http",
"unhealthy": {
"http_failures": 3,
"http_statuses": [500, 502, 503],
"timeouts": 3
},
"healthy": {
"successes": 3,
"http_statuses": [200, 201, 204]
}
}
}
}
}
EOF
```
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The combined active+passive example creates production-backend-service but doesn’t show any route referencing it. Since health checks are only activated for services that are attached to at least one route, this example is incomplete and may lead readers to think checks should run immediately. Either add a route creation step (or explicitly say to reuse/update the route from step 2 with service_id: production-backend-service).

Copilot uses AI. Check for mistakes.
Comment on lines +109 to +110
Health checks run for upstream nodes that are reachable through active
configuration. Verify route wiring with:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is misleading/inconsistent with the troubleshooting note below: health checks aren’t gated by nodes being “reachable through active configuration”; they’re triggered by the service being referenced by at least one route (and passive checks additionally require traffic). Consider rephrasing to explicitly tie health-check execution to route→service binding (e.g., “Health checks run only for services that are referenced by at least one route”).

Suggested change
Health checks run for upstream nodes that are reachable through active
configuration. Verify route wiring with:
Health checks run only for services that are referenced by at least one
route. Verify route wiring with:

Copilot uses AI. Check for mistakes.
Comment on lines 101 to 125
@@ -151,78 +120,46 @@ a7 route create --gateway-group default -f - <<'EOF'
},
"max_breaker_sec": 60
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"backend:8080": 1
}
}
}
EOF
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a7 route update <id> -f performs a full PUT replacement (not a merge/patch). This example only supplies service_id and plugins, so it will likely wipe fields like paths/uri/name, potentially making the route invalid or no longer match any requests. Update the example to send a complete route definition (including existing paths and other required fields), or show a workflow like a7 route get ... --output json → edit → a7 route update ... -f.

Copilot uses AI. Check for mistakes.
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.

2 participants