Skip to content

Conversation

@mrkaye97
Copy link
Contributor

@mrkaye97 mrkaye97 commented Jan 29, 2026

Description

Wiring up attempt filtering + sending retry counts from the Python SDK

Type of change

  • New feature (non-breaking change which adds functionality)
Screenshot 2026-01-29 at 4 09 10 PM Screenshot 2026-01-29 at 4 09 32 PM

@vercel
Copy link

vercel bot commented Jan 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hatchet-docs Ready Ready Preview, Comment Jan 29, 2026 9:57pm

Request Review

Copy link
Contributor

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 wires task retry/attempt context through the Python SDK, ingestion pipeline, and frontend so logs can be filtered by attempt number and display the correct attempt metadata.

Changes:

  • Propagates retry_count from worker actions into a new ctx_task_retry_count context var and includes it when emitting logs via the Python SDK, sending taskRetryCount in the events protocol and storing it as retry_count on v1_log_line.
  • Extends the log listing API (OpenAPI spec, server handler, repository, and SQL) to accept an attempt query parameter that filters logs by attempt number (user-facing 1-based attempt mapped to 0-based retry_count).
  • Updates the frontend log search (parser, autocomplete, query wiring, and UI) to support attempt: filters, display attempts per log line, and provide attempt-aware autocomplete based on the task’s retry count.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sdks/python/pyproject.toml Bumps Python SDK version to 1.22.13 for the new logging/attempt functionality.
sdks/python/hatchet_sdk/worker/runner/utils/capture_logs.py Adds ctx_task_retry_count handling, a typed context-var union, and includes task_retry_count in async log sending and forwarded log records.
sdks/python/hatchet_sdk/worker/runner/runner.py Sets ctx_task_retry_count in async_wrapped_action_func, but currently does not copy it into the thread pool context for sync tasks (see comment).
sdks/python/hatchet_sdk/worker/action_listener_process.py Sets ctx_task_retry_count when starting the action loop so worker-side logs know which attempt they belong to.
sdks/python/hatchet_sdk/runnables/contextvars.py Introduces the ctx_task_retry_count context variable with a default of 0.
sdks/python/hatchet_sdk/context/context.py Ensures context-based log() calls publish a LogRecord carrying the current retry_count to be sent as taskRetryCount.
sdks/python/hatchet_sdk/clients/events.py Extends EventClient.log to accept an optional task_retry_count and forwards it on the PutLogRequest as taskRetryCount.
sdks/python/CHANGELOG.md Documents version 1.22.13 and the new task_retry_count logging behavior for frontend filtering.
pkg/repository/sqlcv1/log_line.sql.go Adds an Attempt parameter and wires it into the ListLogLines SQL call/placeholder sequence.
pkg/repository/sqlcv1/log_line.sql Adds an attempt named argument and filters v1_log_line.retry_count = attempt - 1 to align 1-based attempts with 0-based retry counts.
pkg/repository/log_line.go Extends ListLogsOpts with Attempt and passes it through to the generated SQL params when present.
pkg/client/rest/gen.go Extends V1LogLineListParams and the NewV1LogLineListRequest builder to support an attempt query parameter.
frontend/app/src/lib/api/generated/Api.ts Updates the generated v1LogLineList client method to accept an optional attempt number in its query object.
frontend/app/src/components/v1/cloud/logging/log-search/use-logs.tsx Adds attempt-aware parsing, query keys, API query parameters, log shaping (surfacing row.attempt), and computes availableAttempts from the task’s retryCount.
frontend/app/src/components/v1/cloud/logging/log-search/types.ts Extends ParsedLogQuery with an attempt field.
frontend/app/src/components/v1/cloud/logging/log-search/parser.ts Parses attempt:<n> tokens, validates positive integers, and surfaces them in ParsedLogQuery.
frontend/app/src/components/v1/cloud/logging/log-search/log-search-input.tsx Integrates availableAttempts into autocomplete, refines suggestion application behavior, and adds chips for level: and attempt: filters.
frontend/app/src/components/v1/cloud/logging/log-search/autocomplete.ts Generalizes autocomplete to support multiple filter keys and value suggestions for attempts based on availableAttempts.
api/v1/server/oas/gen/openapi.gen.go Regenerates the OpenAPI server bindings to include the attempt query parameter on V1LogLineList and handle binding/validation.
api/v1/server/handlers/v1/tasks/list_logs.go Plumbs the optional attempt query parameter into ListLogsOpts so repository calls can filter logs by attempt.
api-contracts/openapi/paths/v1/tasks/tasks.yaml Updates the OpenAPI path definition for /tasks/{task}/logs to document the new integer attempt query parameter.

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

@mrkaye97 mrkaye97 merged commit 036ed44 into mk/logs-fe-part-ii Jan 30, 2026
42 of 43 checks passed
@mrkaye97 mrkaye97 deleted the mk/logs-fe-part-iii branch January 30, 2026 17:57
mrkaye97 added a commit that referenced this pull request Jan 30, 2026
* fix: don't toggle selection if a user is dragging

* fix: command selection state

* fix: close search bar on enter

* fix: improve search bar styling a bit, make it more consistent with designs

* chore: tsc

* Feat: Logs Frontend, Part III (#2888)

* fix: propagate retry count through properly

* feat: attempt switcher

* fix: attempt numbers

* feat: add attempt param to log query

* feat: wiring

* feat: attempt filter

* chore: changelog

* fix: use the button component

* fix: only close on enter when in FTS mode

* fix: pass retry count and log level in Go

* fix: feedback

* chore: lint

* fix: rm cruft comment
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