Skip to content

opentofu task logs are buffered until completion — logs_full_size stays 0 for the whole run, and the task list omits log fields entirely #195

Description

@jgruberf5

Summary

An opentofu module produces no readable log until the task completes. logs_full_size stays at 0 for the entire run and jumps to its final value at completion. Separately, the task list endpoint omits log fields entirely, so anything enumerating a module's tasks sees every one as empty even after they finish.

Together these make a running opentofu module completely opaque: you cannot tell a module that is working from one that is wedged until it is over.

Measurement

opentofu module (Harbor VSI), plan task, detail endpoint sampled every 1s:

ELAPSED  STATUS        logs_full_size
1s       in_progress   0
2s       in_progress   0
4s       in_progress   0
5s       in_progress   0
6s       in_progress   0
8s       in_progress   0
9s       in_progress   0
11s      in_progress   0
12s      in_progress   0
13s      in_progress   0
15s      in_progress   0
16s      in_progress   0
18s      completed     4625

Twelve consecutive in-flight samples at exactly 0, then the whole 4625 bytes at once. Reproduced twice (tasks 127 and 128).

The log itself is per-line timestamped once it appears:

[04:42:26] === INIT REQUIRED: Module workspace not initialized ===
...
data.ibm_tg_gateways.all[0]: Read complete after 1s
ibm_is_instance.harbor: Refreshing state... [id=0757_ce100c4a-...]
No changes. Your infrastructure matches the configuration.

So the timestamps are captured progressively during the run — the data exists, it just is not persisted until the end.

Second, separate defect: the list endpoint drops log fields

For the same task, in the same moment:

GET /api/tasks?module_id=19&limit=10   ->  logs_full_size = null
GET /api/tasks/45                      ->  logs_full_size = 33601, logs_truncated = false

null on the list, real data on the detail. A client that enumerates a module's tasks — the obvious way to find "the log for this module" — sees every task as having no output, whether it is running or long finished.

Impact

A 40-minute cluster-create or a 7-minute Harbor VSI build is a black box for its entire duration. There is no progress signal, and no way to distinguish "still working" from "hung", which matters most precisely when something has gone wrong. Our harness worked around this by polling logs_full_size as a liveness signal for container modules, where it does climb — that workaround silently does nothing for the one opentofu module in our catalog.

Environment

BNK Forge v4.0.0-rc1. Module engine opentofu. Container modules in the same catalog do NOT show this: their logs_full_size climbs during an apply, which is why this went unnoticed.

Not a duplicate of #119 / #154

Both of those are closed and both concern container step output — the module log endpoint returning an empty 200, and no task id being exposed. This is a different engine and a different failure: the task id is exposed, the detail endpoint works, and the log is simply not written until the task ends.

Suggested

  1. Flush opentofu task output incrementally, as the container engine already does.
  2. Include logs_full_size (and logs_truncated) in the task list response, or document that logs are detail-only — the current null is indistinguishable from "this task produced no output".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendFastAPI backend: routes, services, tasksbugSomething is broken or behaves incorrectlyobservabilityMetrics, logging, tracing, dashboardsopentofuOpenTofu/Terraform engine and modulesseverity:mediumCorrectness or diagnosability degraded; workaround exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions