Skip to content

feat: enhance parameter annotation resolution in task signatures#477

Merged
jdchawla29 merged 1 commit into
mainfrom
fix-template-annotation-resolution
Jul 1, 2026
Merged

feat: enhance parameter annotation resolution in task signatures#477
jdchawla29 merged 1 commit into
mainfrom
fix-template-annotation-resolution

Conversation

@solvemproblr

@solvemproblr solvemproblr commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Problem

@env.template breaks hud deploy / sync introspection when env files use from __future__ import annotations and template params use rich types (Literal, aliases, Pydantic models, unions).
Failure surfaces as TaskArgs is not fully defined.

Cause

_TaskFactory stored a raw inspect.signature(func).
With postponed annotations, that signature keeps annotation strings, and those unresolved strings were consumed by both manifest schema generation and start-time arg coercion.

Solution

Use an evaluated signature at construction time:

  • In _TaskFactory.__init__, changed to inspect.signature(func, eval_str=True).
  • Existing callers keep using task.sig, but now they get real runtime types.
  • This fixes both manifest args schema generation and runtime coercion without adding new signature APIs.

Note

Low Risk
Single-line signature evaluation change with targeted tests; improves typing/introspection without altering wire protocol or auth paths.

Overview
Fixes hud deploy / sync failures (TaskArgs is not fully defined) when env modules use from __future__ import annotations and @env.template parameters use rich types (Literal, aliases, Pydantic models, unions).

_TaskFactory now stores inspect.signature(func, eval_str=True) instead of a raw signature, so task.sig exposes resolved runtime types for both tasks.list args JSON Schema (_args_json_schema) and wire tasks.start arg coercion (_coerce_args in TaskRunner).

Adds tests that postponed annotations produce correct manifest enums/$ref/defaults and that a full Run coerces string wire args into typed template parameters.

Reviewed by Cursor Bugbot for commit a6ac044. Bugbot is set up for automated code reviews on this repo. Configure here.

@solvemproblr solvemproblr requested a review from jdchawla29 June 30, 2026 02:27
@solvemproblr solvemproblr force-pushed the fix-template-annotation-resolution branch from e2db7c8 to b254819 Compare July 1, 2026 01:17
@solvemproblr solvemproblr force-pushed the fix-template-annotation-resolution branch from b254819 to a6ac044 Compare July 1, 2026 01:17

@jdchawla29 jdchawla29 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@jdchawla29 jdchawla29 merged commit ed75db2 into main Jul 1, 2026
8 checks passed
@jdchawla29 jdchawla29 deleted the fix-template-annotation-resolution branch July 1, 2026 01:19
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