Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ Actions visibility and runner evaluation.
- `docs/bugs/fixed/runners-registering-together-lose-their-tokens.md`
- `docs/bugs/fixed/github-context-identity-values-are-empty.md`
- `docs/bugs/fixed/rendered-github-context-differs-from-github.md`
- `docs/bugs/fixed/container-and-services-jobs-run-on-the-host.md`
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
- `docs/bugs/fixed/unresolved-reusable-workflow-call-passes.md`
- `docs/bugs/fixed/skipped-reusable-workflow-caller-lists-the-called-jobs.md`
- `docs/bugs/fixed/job-needing-a-reusable-workflow-caller-waits-forever.md`
- `docs/bugs/fixed/actions-in-emulator-repositories-are-fetched-upstream.md`
- `docs/bugs/fixed/jobs-list-shows-jobs-waiting-on-needs.md`

## Decisions

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Bug: an action in a repository on the emulator is fetched upstream

Status: fixed 2026-11-14.

## Summary

The emulator resolved and fetched every `uses: owner/repo@ref` from
github.com. An action pushed to a repository on the emulator therefore
failed with "does not exist upstream". GitHub Enterprise Server resolves an
action against a repository it holds, and goes to github.com only for a
repository it lacks. A test stack that pushes its own actions needs the same.

## Fix

- `actionsdownloadinfo` resolves `owner/repo@ref` against a repository on the
emulator first. A name the emulator does not hold goes upstream.
- Unlike GHES, a public repository here that lacks the ref also goes
upstream, so a partial local copy of a public action (one pushed without
all its tags) still works.
- A private or internal repository here that lacks the ref is unresolvable
(`404` `UnresolvableActionDownloadInfoException`), and the archive URL for a
commit it lacks is `404`. Neither is looked up upstream under the same name,
so a private action's name never resolves to a different upstream
repository's code.
- A job may use a repository here as an action only when it is public or is
the job's own repository. GitHub lets other repositories use a private or
internal repository's actions only when its owner enables that access, and
the emulator has no such setting yet, so it allows only these two. Any
other private or internal repository, the same owner's included, is
unresolvable (`404` `UnresolvableActionDownloadInfoException`) and its name
is not looked up upstream. The archive URL applies the same rule (`404`),
since a job can request it directly.
- The name is matched case-insensitively; when two repositories differ only
in case, the first created is used.
- The archive is built with `git archive`, with one top-level directory as in
GitHub's archives, and cached apart from upstream archives
(`action_download_service`).

Tests: `tests/actions/test_emulator_hosted_actions.py`.
28 changes: 28 additions & 0 deletions docs/bugs/fixed/container-and-services-jobs-run-on-the-host.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Bug: container and services jobs run their steps on the runner host

Status: fixed 2026-11-14.

## Summary

On GitHub, a job with `container:` runs its steps inside that container, and
`services:` starts service containers beside the job. Neither runner path in
the emulator starts job or service containers. A job with either key ran its
steps on the runner host instead:

- a step that checked the container (`grep Alpine /etc/os-release`) failed;
- a step that needed only a shell passed.

Either way the outcome described the runner host, not the workflow.

## Fix

`workflow_service.build_job_graph` replaces the steps of a job with
`container:` or `services:` with one step that fails with:

`::error::container: not supported by this emulator's runners; the job's steps were NOT run`

The message names whichever keys are present. This follows the existing
refusal for `docker://` actions (`_unsupported_uses_script`). An empty
`container:` is not a container, and a job without either key is unchanged.

Tests: `tests/actions/test_container_jobs.py`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Bug: a job that needs a reusable-workflow caller waits forever

Status: fixed 2026-11-14.

## Summary

On GitHub, a job can name a reusable-workflow caller in `needs:` and read
`needs.<caller>.result` and `needs.<caller>.outputs`; the outputs are the
callee's `on.workflow_call.outputs`.

The emulator inlines a caller as its called jobs, so the caller is no job in
the run. A job with `needs: <caller>`:

- waited for a job that never existed, and stayed `waiting`;
- had nothing to read in `needs.<caller>.outputs`.

## Fix

- A need on a caller becomes a need on every job the call inlined.
- The dependent carries the caller's called-job keys and the callee's
`on.workflow_call.outputs`. At promotion the scheduler builds
`needs.<caller>` from them: the result is the worst of the called jobs'
results, and the outputs are evaluated with a `jobs` context of the called
jobs.
- The dependent waits for every called job, but its implicit `success()`,
and `success()`/`failure()` in its `if:`, read the call's result, not each
called job's. On GitHub a call whose jobs succeeded except one skipped by
its own `if:` succeeds, and a `needs: <caller>` dependent with no `if:`
runs. Before, the scheduler saw the skipped called job as an unsuccessful
need and skipped the dependent. A call with a failed or cancelled job is
still unsuccessful, so its dependent is still skipped. Plain needs are
judged as before.
- The same holds further down a chain. `success()` and `failure()` answer
for every ancestor, and a called job reached through another job is
counted as its caller, with the call's result (the worst of its called
jobs' results). The caller is found from the key: called jobs are keyed
`<caller> / <job>`, and a job id cannot hold ` / `. For `call -> middle ->
final`, with `final` on `if: success()` and the call holding one
successful job and one skipped by its own `if:`, `final` now runs. Before,
only `final`'s own needs were read through the call's alias, so `success()`
saw the skipped called job and `final` was skipped. Inside a called
workflow, `deploy / final` counts `deploy / call / *` as the
`deploy / call` call. A failed called job still skips `middle` and makes
`success()` false and `failure()` true for `final`, as behind a plain
failed job.
- Nested calls re-prefix those keys at each level.
- A caller inside a called workflow keeps its own alias inside the outer
caller's alias (`callers`). The outer call's outputs can then read
`jobs.<nested caller>.outputs`: that entry is built the same way, from the
nested caller's called jobs and its own `on.workflow_call.outputs`. Before,
the outer `jobs` context held only the flattened called jobs
(`<nested caller> / <job>`), so such an output rendered as `""`.
- A skipped caller is one skipped job under its own key
(`skipped-reusable-workflow-caller-lists-the-called-jobs.md`), so a need on
it points at that job. Its `needs.<caller>` is then that job's own entry
(`result: skipped`); the entry built from called jobs, which were never
created, is dropped. Before, it overwrote the real entry with `result: ''`.
- Only needs on the run's own (top-level) callers are pointed at a skipped
caller's job (`_caller_needs`). A caller in a called workflow can share a
top-level caller's key; a need on it used to be pointed at the skipped
top-level job instead.
- A call's outputs are evaluated with the contexts GitHub allows in
`on.workflow_call.outputs.<output_id>.value`: `github`, `jobs`, `vars` and
`inputs` ([contexts reference, context availability][contexts]). The alias
carries the call's resolved inputs (the caller's `with:` plus the callee's
declared defaults), nested callers' aliases included, and the scheduler
passes the run's `github` and `vars`. Before, only `jobs` was there, so
`${{ inputs.version }}` rendered as `""` even when the caller passed it or
it had a default. `with:` values still holding an expression are rendered
at promotion against `github`, `vars`, `needs` and the calling workflow's
inputs. `secrets` is not in that context, as on GitHub.
- For the run's own (top-level) callers, "the calling workflow's inputs" are
the run's inputs (`inputs` in the run's expression context, from the
`workflow_dispatch` or `workflow_call` payload), the same values the called
jobs render their `with:` against. Before, the alias used `{}` there, so a
compound expression such as `${{ format('{0}-x', inputs.ver) }}` gave the
called job `1.0-x` but `needs.<caller>.outputs` `-x`. For a caller inside
a called workflow, they are that workflow's inputs, not the run's.
- Calls nested at any depth resolve each `with:` in the terms of the
workflow it is written in. The alias keeps the `with:` of every enclosing
call (`parent_inputs_chain`, outermost first), and each called job keeps
the same chain (`_call_inputs_chain`). Both are rendered one level at a
time: the rendered inputs of one level are the `inputs` context of the
next, starting from the run's inputs. Before, the alias kept only the
innermost calling workflow's inputs and rendered them against the run's,
and the called jobs rendered all levels' merged inputs in one pass against
the run's. With the run's `ver=run`, `outer` called with `ver=2`, `mid`
with `ver=${{ format('{0}-mid', inputs.ver) }}` and `inner` with
`tag=${{ format('v{0}', inputs.ver) }}`, a job in `mid` read `run-mid`
for `inputs.ver` and `vrun-mid` for `needs.inner.outputs.tag`; they are now
`2-mid` and `v2-mid`.
- A bare `${{ inputs.x }}` in a called workflow is substituted at
materialization only when the passed value is a literal. A value that is
itself an expression is in the calling workflow's terms, so the reference
is kept and reads the job's rendered inputs. Before, the expression was
copied in and then rendered against the called workflow's inputs: with
`ver=${{ format('{0}-mid', inputs.ver) }}`, `${{ inputs.ver }}` in `mid`
became `2-mid-mid`.
- A caller that needs another caller (A → B → C, B with
`x: ${{ needs.A.outputs.o }}`) keeps the aliases of the callers it needs
(`needs_aliases`, in any job order; a needs cycle is cut). Its `with:` is
rendered with `needs.A` built from A's called jobs, the entry a plain
dependent of A reads. Before, C's called jobs read `needs.B` from B's
alias, which rendered `needs.A` against plain job rows only, so
`needs.B.outputs` was `""`, C's jobs received an empty input, and
`needs.C.outputs` was empty too. B's own called jobs already rendered
`inputs.x` correctly from their own `needs.A` entry.

[contexts]: https://github.com/proxy/docs.github.com/en/actions/reference/workflows-and-actions/contexts#context-availability

Tests: `tests/actions/test_reusable_caller_needs.py`,
`tests/actions/test_skipped_reusable_caller.py`.
22 changes: 22 additions & 0 deletions docs/bugs/fixed/jobs-list-shows-jobs-waiting-on-needs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Bug: a run's jobs list shows jobs still waiting on needs

Status: fixed 2026-11-14.

## Summary

Probed side by side with GitHub, with a workflow where jobs `b` and `c` need
job `a`. While `a` ran, GitHub's `GET /repos/{owner}/{repo}/actions/runs/{id}/jobs`
listed only `a` (`total_count` 1). `b` and `c` appeared once they were
queued.

The emulator listed `b` and `c` with status `waiting`. GitHub uses `waiting`
for a job held for an environment approval. A stage that had not started
looked like part of the run, and a client that checks once that a job is not
going to run read it as pending.

## Fix

The jobs list leaves out jobs that are still blocked on `needs:`. A job is
listed from when it is queued.

Tests: `tests/actions/test_jobs_list_unstarted.py`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Bug: a skipped reusable-workflow caller lists the called jobs, and the run succeeds

Status: fixed 2026-11-14.

## Summary

On GitHub, a job that calls a reusable workflow
(`uses: ./.github/workflows/reusable-dispatch.yml`) and is skipped by its own
`if:` is never expanded. The run lists one job, named after the caller job
(its `name:`, or its key), concluded `skipped`. A run whose jobs were all
skipped concludes `skipped`.

The emulator inlined the called jobs at run creation and ANDed the caller's
condition into each of them. For Fullsend's `fullsend.yaml`, whose `dispatch`
job runs only for `issues` events labelled `go`, an `issues: opened` event
produced a run that:

- listed every called job (`dispatch / route`, `Triage`, `Code` and two
`Harness run (${{ matrix.agent }})` jobs), each `skipped`;
- concluded `success`, because the run conclusion treated "all skipped" as
success.

Fullsend's behaviour tests skip runs that concluded `skipped` or `cancelled`.
They read a `success` run whose "Harness run" job was skipped as a failed
dispatch.

A job that `needs:` the caller key (`needs: dispatch`) also never resolved,
because no row carried that key, so it stayed waiting.

## Fix

- `workflow_service._materialize_reusable_jobs` marks each job inlined from
a top-level call with its caller (`_caller`: key, name, condition, needs).
`build_job_graph` carries the mark.
- `create_workflow_run` evaluates a caller's `if:` once, when the caller has
no `needs:`. When it is false, the run gets one skipped row, named after
the caller and keyed by the caller's key, and none of the called jobs.
Jobs that need the caller are skipped through it as usual; one that runs
anyway (`if: always()`) reads `needs.<caller>.result` as `skipped`.
- `workflow_scheduler.check_run_completion` concludes a run `skipped` when
every job concluded `skipped`. Runs where some jobs ran keep their
`success` or `failure` conclusion.

When the caller runs, the called jobs and their names are unchanged.

Not covered: a caller with `needs:` is still decided at promotion, where its
condition is ANDed into each called job, so a skip there still lists the
called jobs. The emulator does not mirror check suites or send `workflow_run`
webhooks, so there is no other conclusion to update.

Tests: `tests/actions/test_skipped_reusable_caller.py`.
37 changes: 37 additions & 0 deletions docs/bugs/fixed/unresolved-reusable-workflow-call-passes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Bug: a reusable-workflow call that cannot be inlined passes

Status: fixed 2026-11-14.

## Summary

The emulator inlines a reusable-workflow call into the called jobs. When it
could not, it left a placeholder job with no steps, and a job with no steps
passes. That happened for:

- a cross-repository call (`owner/repo/.github/workflows/x.yml@ref`) to a
repository the emulator does not store;
- a call nested deeper than the limit;
- a call that loops back to itself.

A run whose whole pipeline was one such call looked green. On GitHub the
same run fails.

## Fix

`workflow_service._materialize_reusable_jobs` builds the placeholder with
`_reusable_placeholder`, which gives it one step that fails with an
`::error::` saying why. For a missing repository the message says the call
resolves only against repositories stored in the emulator, and that the
repository has to be pushed first. The placeholder no longer carries `uses`,
`with` or `secrets`.

GitHub fails such a run without assigning a runner. The placeholder is
therefore never queued: `create_workflow_run` concludes it `failure` when
the run is created, or, for a placeholder with `needs:`, the scheduler
concludes it when its needs finish and its `if:` holds
(`workflow_service.fail_refused_job`). Its one step is recorded as the
failed step, and the reason is written to the job's log. Queued, it waited
forever on a stack whose runners do not offer its `runs-on` labels
(`ubuntu-latest` by default).

Tests: `tests/actions/test_reusable_unresolved.py`.
7 changes: 6 additions & 1 deletion src/app/api/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,12 @@ async def list_jobs(
if run_result.scalar_one_or_none() is None:
raise HTTPException(status_code=404, detail="Not Found")

query = select(WorkflowJob).where(WorkflowJob.run_id == run_id)
# A job still waiting on its `needs` is not listed: GitHub lists a job
# once it is queued (or decided, e.g. skipped). Its "waiting" status is
# for a job held for an environment approval, which this emulator does
# not have; listing blocked jobs as waiting made a not-yet-started stage
# look like one that ran.
query = select(WorkflowJob).where(WorkflowJob.run_id == run_id, WorkflowJob.status != "waiting")
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
jobs = (await db.execute(query)).scalars().all()
items = [_job_json(j, owner, repo) for j in jobs]
return {"total_count": len(items), "jobs": items}
Expand Down
Loading
Loading