Skip to content

fix: use correct JobResult field names for credential error handling#750

Open
KeitaW wants to merge 1 commit intoNVIDIA:mainfrom
KeitaW:fix/jobresult-parameter-mismatch
Open

fix: use correct JobResult field names for credential error handling#750
KeitaW wants to merge 1 commit intoNVIDIA:mainfrom
KeitaW:fix/jobresult-parameter-mismatch

Conversation

@KeitaW
Copy link
Copy Markdown

@KeitaW KeitaW commented Mar 29, 2026

Summary

Fixes incorrect JobResult constructor parameters in four credential-check locations. The code used success=False and error='...' but JobResult only has status and message fields. Pydantic silently ignores the unknown fields, causing credential failures to return SUCCESS instead of FAILED_NO_RETRY.

Affected jobs:

  • UploadWorkflowFiles.execute() (L382-386)
  • CleanupWorkflow.execute() (L1389-1393)
  • UploadApp.execute() (L1730-1733)
  • DeleteApp.execute() (L1790-1793)

Impact: When workflow_log.credential or workflow_app.credential is None, the worker logs "completed with status SUCCESS" while no files are uploaded to S3. This makes credential misconfiguration completely invisible.

Fix: Replace success=False, error='...' with status=JobStatus.FAILED_NO_RETRY, message='...' — matching the pattern used elsewhere (e.g., worker.py, backend_jobs.py).

Fixes #748

Test plan

  • Deploy with workflow_log.credential unset
  • Submit a workflow and verify worker logs show FAILED_NO_RETRY: Workflow log credential is not set
  • Verify existing workflows with valid credentials still upload logs successfully

Summary by CodeRabbit

  • Refactor
    • Updated job execution error handling to use improved failure status reporting when credentials are missing, enhancing consistency in how job failures are communicated.

JobResult has `status` and `message` fields, but four credential-check
locations used `success` and `error` — which Pydantic silently ignores,
causing credential failures to return SUCCESS instead of FAILED_NO_RETRY.

Affected: UploadWorkflowFiles, CleanupWorkflow, UploadApp, DeleteApp.

Fixes NVIDIA#748
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

📝 Walkthrough

Walkthrough

The PR fixes incorrect JobResult field usage in four job methods. Previously, credential-missing early returns used non-existent success and error fields which Pydantic silently ignored, causing jobs to incorrectly report SUCCESS. Now they correctly use status=JobStatus.FAILED_NO_RETRY and message fields.

Changes

Cohort / File(s) Summary
Credential Validation Bug Fixes
src/utils/job/jobs.py
Fixed JobResult construction in four job methods: UploadWorkflowFiles.execute(), CleanupWorkflow.execute(), UploadApp.execute(), and DeleteApp.execute(). Changed from incorrect success=False, error=... parameters to correct status=JobStatus.FAILED_NO_RETRY, message=... parameters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 The jobs once whispered "SUCCESS" with a sigh,
While credentials were missing—oh my, oh my!
Now with FAILED_NO_RETRY so bright,
No silent failures hide from sight!
The rabbit rejoices, bugs take their flight! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing incorrect JobResult field names in credential error handling across four job methods.
Linked Issues check ✅ Passed The PR directly addresses issue #748 by correcting all four JobResult constructor calls to use status=JobStatus.FAILED_NO_RETRY and message= instead of success=/error= fields.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the four credential-check early returns in job execute methods, matching the objectives in issue #748 with no unrelated modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/utils/job/jobs.py (1)

382-385: Optional: Consider adding extra = 'forbid' to JobResult in jobs_base.py.

As noted in issue #748, adding Pydantic's extra = 'forbid' configuration to JobResult (similar to JobExecutionContext at lines 61-63 of this file) would catch incorrect constructor fields at creation time, preventing silent failures in the future.

# In src/utils/job/jobs_base.py
class JobResult(pydantic.BaseModel):
    status: JobStatus = JobStatus.SUCCESS
    message: Optional[str]

    class Config:
        extra = 'forbid'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/job/jobs.py` around lines 382 - 385, Add Pydantic strictness to the
JobResult model so unknown fields raise errors: update the JobResult class in
jobs_base.py to include an inner Config with extra = 'forbid' (similar to
JobExecutionContext's Config), ensuring JobResult(...) construction fails fast
on unexpected constructor fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/utils/job/jobs.py`:
- Around line 382-385: Add Pydantic strictness to the JobResult model so unknown
fields raise errors: update the JobResult class in jobs_base.py to include an
inner Config with extra = 'forbid' (similar to JobExecutionContext's Config),
ensuring JobResult(...) construction fails fast on unexpected constructor
fields.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0ade3af1-180d-465c-9d88-6e89d89365aa

📥 Commits

Reviewing files that changed from the base of the PR and between 2e44c97 and acff603.

📒 Files selected for processing (1)
  • src/utils/job/jobs.py

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.

bug: JobResult constructed with wrong field names — credential errors silently return SUCCESS

1 participant