Should an unknown CometAPI router task silently become a customer reply?

Pass "policy_reveiw" instead of "policy_review" to the router in CometAPI’s task-routing tutorial, and the example selects the customer-reply tier order. It does not report an unknown task.

That is a small application-policy choice worth making explicit before adopting this CometAPI integration. It does not mean CometAPI rewrites the prompt into a customer reply or sends a message to a customer.

Where the default comes from

The tutorial keeps routing in your application, then calls the selected model through CometAPI’s https://api.cometapi.com/v1 base URL and Chat Completions interface. Its route loop contains:

for tier in ROUTES.get(task, ROUTES["reply"]):

The published reply order is fast → cheap → accurate; policy_review starts with accurate, then falls back to fast → cheap. These are the application’s tier labels, not measured model rankings.

Reading that control flow, an unknown string selects the reply order while leaving the prompt unchanged. This is a consequence of the sample’s dictionary lookup, not evidence of a CometAPI server-side default. Omitting the required task argument entirely is a different error; it is not the same as passing a misspelled value.

Make a closed vocabulary fail before the API call

For an application with exactly three approved tasks, I would reject unknown values rather than silently reinterpret them. Starting from the tutorial’s existing ROUTES dictionary, add this application-side helper:

def approved_tiers(task):
    if not isinstance(task, str) or task not in ROUTES:
        raise ValueError("Unsupported task; use tag, reply, or policy_review")
    return ROUTES[task]

Then replace the original loop header with:

for tier in approved_tiers(task):

Keep the rest of the model-selection and CometAPI call code inside the loop. The guard now runs before that call. This is a proposed patch, not a service-tested replacement router or an official CometAPI requirement.

At the request boundary, handle the validation error as invalid input. Do not catch it and retry through another model: changing models cannot repair a misspelled task label.

Test the boundary, not just the happy path

Use a stub for the CometAPI client when testing the patched router. The expected checks are:

Input Expected routing behavior
"tag" Starts with cheap
"reply" Starts with fast
"policy_review" Starts with accurate
"policy_reveiw", "", or None Validation error; zero client calls

Those are test expectations, not reported execution results. In particular, assert the zero-call condition: merely checking that an error eventually appears would miss a router that makes a request first.

If unknown task labels genuinely belong to a general-assistance path, an explicit default can be reasonable. Document that policy, test its tier order, and record when it is used. For a controlled vocabulary, my preference is to keep reply an intentional task rather than an accidental escape hatch.

This guard only answers which task is allowed to reach the CometAPI model call. Keep the tutorial’s separate task-specific output validation and bounded fallback policy; accepting a task label does not establish output quality or current model compatibility.

Source scope: the official article was published September 1 and captured September 8, 2026. The point here is its application router’s control flow, not current model prices or a live performance comparison.

A fail-closed router also needs an observable rejection path. Otherwise a deployment that breaks task labels could look like a healthy reduction in CometAPI traffic while users receive fewer usable results.

For the proposed guard, I would use this application-side runbook:

  • Count inbound routing attempts and task-validation rejections separately from upstream model-call failures. Use bounded reason labels such as unknown_task and invalid_type; do not use arbitrary incoming task strings or prompt contents as metric labels.
  • Track end-to-end completion alongside upstream availability. A request rejected before the client call should be visible as an application failure, not attributed to a CometAPI outage or omitted from the user-facing success denominator.
  • On a rejection spike after a release, compare the caller’s task vocabulary with the router’s accepted vocabulary and deployment versions first. Escalate to the application owner rather than changing models or opening an upstream-availability incident solely from that signal.

A useful rollout check is a synthetic misspelled task that increments the rejection counter while producing zero upstream attempts. That extends the zero-call assertion into an observability check; it is a proposed test, not a reported result.

If a caller/router version mismatch is confirmed, pause the rollout or restore a compatible version pair that retains explicit validation. Do not restore service by silently mapping rejected policy-review requests to reply. The stop condition is unresolved vocabulary compatibility, not exhaustion of another model’s retry budget.