Skip to content

Improve apify push final status and JSON output for agents #1136

@patrikbraborec

Description

@patrikbraborec

Summary

Improve apify push output so agents can clearly distinguish source upload success from final cloud build success.

Problem

apify push currently streams build logs and returns a non-zero exit code when the build fails. This technically gives agents enough information.

However, because the command has multiple phases, agents can still misinterpret the result:

  1. Actor created/updated
  2. Source uploaded
  3. Cloud build started
  4. Cloud build failed

An agent may summarize the command as “Pushed the Actor to Apify” after seeing the earlier successful phases, even though the final build failed.

Desired human-readable output

At the end of apify push, print a clear final status block:

Apify push result: FAILED

Upload: SUCCEEDED
Build: FAILED
Actor ID: M4wKY3jNvHeoT87xA
Build ID: ...
Build number: 0.0.1
Exit code: 1

Actor URL: ...
Build URL: ...

Reason:
npm error command sh -c node scripts/fail-build.js
ACTOR: ERROR: Container image build failed

For successful builds:

Apify push result: SUCCEEDED

Upload: SUCCEEDED
Build: SUCCEEDED
Actor ID: ...
Build ID: ...
Build number: ...
Actor URL: ...
Build URL: ...

Desired JSON output

apify push --json should return a final result object with an explicit ok field:

{
  "ok": false,
  "operation": "push",
  "actor": {
    "id": "M4wKY3jNvHeoT87xA",
    "url": "https://console.apify.com/actors/M4wKY3jNvHeoT87xA"
  },
  "build": {
    "id": "...",
    "number": "0.0.1",
    "status": "FAILED",
    "url": "https://console.apify.com/actors/M4wKY3jNvHeoT87xA#/builds/0.0.1"
  },
  "error": {
    "phase": "build",
    "message": "Build failed",
    "logTail": [
      "npm error command sh -c node scripts/fail-build.js",
      "ACTOR: ERROR: Container image build failed"
    ]
  },
  "exitCode": 1
}

Acceptance criteria

  • apify push prints a final result summary.
  • apify push --json includes ok, operation, actor, build, and exitCode.
  • Failed, timed-out, and aborted builds return non-zero exit codes.
  • Upload success is not presented as overall push success when the build fails.

Metadata

Metadata

Assignees

Labels

t-dxIssues owned by the DX team.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions