Skip to content

Fixes #37287: store agent logs in S3 whenever the server is configured for it - #37394

Merged
manerow merged 9 commits into
mainfrom
fix/37287-agents-use-log-storage
Nov 18, 2026
Merged

manerow merged 9 commits into
mainfrom
fix/37287-agents-use-log-storage

Conversation

@manerow

@manerow manerow commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #37287
Fixes #36568

Problem

A server can store agent logs in S3, so they survive the run's pod. Configuring the bucket wasn't enough: each agent also has an enableStreamableLogs flag, off by default and absent from the UI. Admins had to turn it on through the API and redeploy, for every agent, including future ones. Missed agents kept their logs only in their pods, which the Kubernetes orchestrator deletes.

Auto Classification logs were never stored even with the flag on. The server refused every upload from that agent's bot, answered 500, and the run still ended as successful.

Why it happened

  • Before 2.0, a deploy turned the flag on when S3 was configured and PIPELINE_SERVICE_CLIENT_LOG_ENABLED was true. PR #28741 moved that decision into one method every deploy path calls, so Hybrid Runner setups could derive it from the runner. In OpenMetadata the method does nothing.
  • Writing logs required EditAll on the pipeline. A run reports its status and progress with EditIngestionPipelineStatus, which every bot has. The Auto Classification bot has no EditAll on pipelines.

What this PR changes

  • S3 is the only switch. When the server stores logs in S3, every deploy turns the agent's flag on. Otherwise agents keep their own value. PIPELINE_SERVICE_CLIENT_LOG_ENABLED is deprecated and ignored. The shipped configuration files no longer set it, but it stays in the schema so existing configuration files keep loading.
  • The redeploy after an edit saves the flag. That deploy works on a copy, so its decision was lost.
  • Each run's logs are read from where that run wrote them, not from the pipeline's current flag, which can differ from what the run was deployed with. With S3, a finished run is read from S3 when its logs are there and from the runner otherwise, and a run still going is read from where its pipeline ships them. Without S3 nothing changes.
  • Log writes use the run's own permission. Writing and closing logs accept EditIngestionPipelineStatus or EditAll, like the other run-reporting endpoints, and a refusal returns 403. A custom role granted only EditIngestionPipelineStatus (for example, to enable and disable pipelines) can now also write that pipeline's logs.

What users will notice

With S3 configured, each agent stores its logs from its next deploy, Auto Classification included. This includes servers that had type: s3 with PIPELINE_SERVICE_CLIENT_LOG_ENABLED off. Older runs, and finished runs with nothing in S3, show the runner's logs instead of a blank tab.

How it was tested

  • Unit tests for the deploy decision, for the redeploy after an edit storing and recording the flag, and for where each run's logs are read from.
  • Integration tests: the Auto Classification, profiler and ingestion bots can write and close logs, and a user without permission gets 403. Without the change, both the Auto Classification bot and that user get 500.
  • A local end-to-end run on the Kubernetes test cluster with S3-compatible storage: a new agent and an edited existing agent got the flag in the stored pipeline and the deployed configuration, and logs shipped by the Auto Classification bot were read back from storage. It predates the per-run read change.

Not in this PR

  • Removing PIPELINE_SERVICE_CLIENT_LOG_ENABLED from the schema.
  • Two other redeploy paths (a data contract redeploying a deployed pipeline, and the redeploy after deleting a namesake pipeline) don't store the flag. Their finished runs are still read from where they wrote; a run in progress is read from the runner until it finishes.
  • Updating the Kubernetes log storage docs, which goes to docs-om separately.

Decision records

  • ADR:2026-11-10-s3-log-storage-drives-streamable-logs
  • ADR:2026-11-10-log-writes-accept-edit-ingestion-pipeline-status

RetriggerView in GreptileConfidence Score: 5/5

The latest changes appear safe to merge; no new blocking issues were found.

Summary

The PR makes S3 configuration turn on stored agent logs at deploy time, saves that choice after edits, and reads logs from the source appropriate to each run.

  • Pipelines ship logs when the server stores logs in S3.
  • Log readers choose S3 or the runner based on each run.
  • Agent bots can write logs with their run-status permission.

manerow accepted the test setup's limit: default storage cannot return a successful upload, so the bot upload check permits storage errors; closing the same run must return 200.

Reviews (8) · Last reviewed commit: "chore: drop the deprecated log storage e..." · Reviewed by Greptile

@manerow manerow added safe to test Add this label to run secure Github workflows on PRs backend labels Nov 9, 2026
@manerow
manerow requested review from a team and tutte as code owners November 9, 2026 08:15
@manerow manerow added safe to test Add this label to run secure Github workflows on PRs backend labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 81%
81.8% (142379/174042) 69.29% (52197/75324) 72.29% (29217/40416)

@github-actions

Copy link
Copy Markdown
Contributor

✅ Generated Sources Auto-Updated

The generated TypeScript types (src/generated/) and dereferenced JSON
schemas (src/jsons/, public/jsons/) have been automatically updated
based on JSON schema changes in this PR.

@sonarqubecloud

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 2 closed / 2 findings

Changing log-write authorization to accept EditIngestionPipelineStatus lets more principals write pipeline logs, which could enable misleading run records.

Stores agent logs in S3 whenever the server is configured for it, turning on each agent's streamable logs flag at deploy and saving it on edit, and lets run-status bots write logs. Two issues were resolved this session: the missing decision records for the S3 flag and log-write permission rules, and a finished run being treated as still going when its storage had aged out. No open issues found.

✅ 2 closed
✅ Quality: S3-forces-streamable-logs and log-write permission rules are unrecorded

📄 openmetadata-spec/src/main/resources/json/schema/configuration/logStorageConfiguration.json:16 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/IngestionPipelineRepository.java:692 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/IngestionPipelineRepository.java:1498-1505 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/IngestionPipelineRepository.java:2006-2013 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/services/ingestionpipelines/IngestionPipelineResource.java:1684-1691
This PR makes two decisions that other components and operators have to go along with, and no record in docs/decisions/ covers either one (I searched for streamable logs, log storage and EditIngestionPipelineStatus and found nothing). The rules exist only in the PR description, and that text is lost when the PR is squash-merged.

  1. Config contract. The description says "When the server stores logs in S3, every deploy turns the agent's enableStreamableLogs flag on; otherwise agents keep their own value" and "PIPELINE_SERVICE_CLIENT_LOG_ENABLED is deprecated and ignored but stays in the schema." This changes what the logStorageConfiguration.enabled field in the JSON Schema means. The rule a record would state: logStorageConfiguration.type == s3 with a bucket forces enableStreamableLogs=true on every deploy (applyStreamableLogsConfig). enabled is kept only so old config files still load, and nothing reads it. Every deploy path that saves the pipeline must also save the flag the deploy chose (the copy in deployPipelineBeforeUpdate). The data-contract redeploy and the namesake redeploy are known exceptions.
  2. Authorization contract. The description says "Writing and closing logs accept EditIngestionPipelineStatus or EditAll" and "A custom role granted only EditIngestionPipelineStatus can now write logs for that pipeline, which is intended." The rule a record would state: POST /logs/{fqn}/{runId} and /close are authorized with ANY of EditIngestionPipelineStatus or EditAll on the pipeline, because a run ships its logs with the same bot token that reports its status.

The updater also relies on an ordering: deployIfRequired has to run before the enableStreamableLogs comparison. That ordering belongs in the first record.

✅ Edge Case: Aged-out finished run counts as going and is tailed from empty storage

📄 openmetadata-service/src/main/java/org/openmetadata/service/logstorage/stream/IngestionLogStreamFactory.java:85-88 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/IngestionPipelineRepository.java:1698-1704
readsFromLogStorage sets runGoing = runState(...) != RunState.FINISHED, so a run counts as going whenever its state is UNKNOWN. stateOf returns UNKNOWN in two cases: a run that has not written a status yet, and an older run that has dropped out of the small getRecentPipelineStatuses window. Take an older run that has aged out and stored nothing in S3, for example one from before S3 was configured or one whose upload failed, on a pipeline that ships logs now. readsRunLogsFromStorage returns true from the runGoing && shipsLogsToStorage branch without calling logsExist. The stream then tails an empty S3 object even though the runner still has the logs. That goes against the ADR consequence this commit adds: "When storage holds nothing for a finished run … the logs are read from the runner." A fix is to look up the run's own status by run id when it is missing from the recent window, and count it as going only if no status row exists for it at all.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@manerow
manerow merged commit bf23ce1 into main Nov 18, 2026
66 checks passed
@manerow
manerow deleted the fix/37287-agents-use-log-storage branch November 18, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agents don't use log storage when it is enabled on the server Auto Classification logs are never stored when pipeline log storage is on

3 participants