Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Oct 6, 2025

Summary by CodeRabbit

  • New Features

    • Added support for a Replicate-Max-Lifetime header to cap prediction runtime across creation endpoints.
    • Prediction responses now include a deadline timestamp indicating when a running prediction will be auto-canceled.
  • Documentation

    • OpenAPI updated to document the new Replicate-Max-Lifetime header (supports unit-based durations like 5m, 1h30m).
    • Schemas updated to include the deadline field in prediction responses.

@coderabbitai
Copy link

coderabbitai bot commented Oct 6, 2025

Walkthrough

Adds a new Replicate-Max-Lifetime request header across prediction-creation endpoints and introduces a deadline timestamp field in prediction responses. Updates the OpenAPI spec to define the header, reference it in relevant operations, and expose the absolute cancellation time in the prediction schema.

Changes

Cohort / File(s) Summary
New header parameter definition
src/libs/Replicate/openapi.yaml
Adds components.parameters.parameters_max_lifetime_header defining Replicate-Max-Lifetime (string duration, e.g., 5m) with validation/description.
Endpoint header references
src/libs/Replicate/openapi.yaml
Extends prediction-related operations (e.g., deployments.predictions.create, models.predictions.create, predictions.create, …) to include references to parameters_max_lifetime_header alongside Prefer.
Response schema update
src/libs/Replicate/openapi.yaml
Adds deadline (string, date-time) to schemas_prediction_response indicating the absolute auto-cancel time.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant API as Replicate API
  participant S as Scheduler/Worker

  Note over C,API: Prediction creation with optional Replicate-Max-Lifetime header
  C->>API: POST /predictions (Replicate-Max-Lifetime: "5m")
  API->>API: Parse duration, compute deadline = now + lifetime
  API->>S: Create prediction job with deadline
  API-->>C: 201 Created { ..., deadline: ISO-8601 }

  Note over S: Run prediction until completion or deadline
  alt completes before deadline
    S-->>API: status=success
    API-->>C: GET /predictions/{id} -> success (deadline unchanged)
  else exceeds deadline
    S->>API: timeout reached
    API->>S: cancel job
    API-->>C: GET /predictions/{id} -> status=canceled
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

I set a clock on dreams to run,
Five minutes hop, then job is done;
A deadline nibbling near the edge,
Cancel bells, a carrot pledge.
Tick-tock, whiskers mark the time—
Predictions leap, then land sublime. 🥕⏳

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The pull request title “feat:@coderabbitai” does not describe the actual features added such as the new Replicate-Max-Lifetime header and deadline field in the OpenAPI spec. It fails to communicate the primary purpose of the changeset, making it difficult for reviewers to quickly grasp the update. This generic tag is unrelated to the content of the changes. Please update the title to clearly reflect the primary changes, for example “Add Replicate-Max-Lifetime header and deadline field to prediction responses.” A clear and descriptive title will help reviewers and future maintainers quickly understand the purpose of this pull request. Improving the title in this way enhances repository history and code traceability.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202510062112

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0df124 and 33b9545.

⛔ Files ignored due to path filters (7)
  • src/libs/Replicate/Generated/Replicate.IReplicateApi.DeploymentsPredictionsCreate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.IReplicateApi.ModelsPredictionsCreate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.IReplicateApi.PredictionsCreate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.Models.SchemasPredictionResponse.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.ReplicateApi.DeploymentsPredictionsCreate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsPredictionsCreate.g.cs is excluded by !**/generated/**
  • src/libs/Replicate/Generated/Replicate.ReplicateApi.PredictionsCreate.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Replicate/openapi.yaml (5 hunks)
🔇 Additional comments (2)
src/libs/Replicate/openapi.yaml (2)

262-263: Header exposure covers new control

Thanks for wiring the new Replicate-Max-Lifetime header into deployments.predictions.create so clients discover it through the spec.


1480-1483: Deadline field completes the story

Documenting the absolute cancellation deadline in the response schema closes the loop for clients tracking expiry.


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

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

@HavenDV HavenDV enabled auto-merge (squash) October 6, 2025 21:12
@HavenDV HavenDV merged commit 1321728 into main Oct 6, 2025
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202510062112 branch October 6, 2025 21:14
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add Replicate-Max-Lifetime header and prediction deadline field Oct 6, 2025
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