Skip to content

Fixes #37287: store agent logs in S3 whenever the server is configured for it (backport 2.1 #37394) - #38103

Merged
manerow merged 1 commit into
2.1from
fix/37287-agents-use-log-storage-2.1
Nov 18, 2026
Merged

manerow merged 1 commit into
2.1from
fix/37287-agents-use-log-storage-2.1

Conversation

@manerow

@manerow manerow commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Backport of #37394 to 2.1. Fixes #37287. Fixes #36568.

When the server stores agent logs in S3, every deploy now turns the agent's enableStreamableLogs flag on, so admins no longer have to enable it per agent through the API. The redeploy after an edit saves that flag, each run's logs are read from where that run wrote them, and log writes accept EditIngestionPipelineStatus like the other run-reporting endpoints, so the Auto Classification bot can store its logs. PIPELINE_SERVICE_CLIENT_LOG_ENABLED is deprecated and ignored; it stays in the schema so existing configuration files keep loading.

The eight commits of #37394 cherry-picked cleanly onto 2.1 and were squashed into one; git patch-id --stable is identical to the diff of #37394.

Type of change:

  • Bug fix

Tests:

Unit tests

  • IngestionPipelineRepositoryTest, S3LogStorageTest and IngestionLogStreamFactoryTest on 2.1: 146 passed.

Backend integration tests

  • IngestionPipelineLogStreamingResourceIT comes with the change and runs in CI.

UI screen recording:

Not applicable: backend-only change (the UI files are regenerated types).

Checklist:

RetriggerView in GreptileConfidence Score: 4/5

Address the Java guide requirements before merging; also fix the active-run read choice and tighten the write assertion.

Findings

  1. P2 Redeploy hides active-run logs ▶
  2. P2 Write checks accept unrelated failures ▶
  3. P2 Deploy tests replace internal code ▶
  4. P2 Test exceeds the argument limit ▶
  5. P2 New bindings omit `final` ▶
  6. P2 Test strings lack constants ▶

Summary

This backport automatically turns on S3 log uploads during deployment and chooses where to read logs using each run’s state.

  • S3-configured pipeline deploys turn on log shipping.
  • Log readers follow each run to the place its logs were written.
  • Agent bots can write and close run logs with status permission.

The review found an active-run routing gap, a loose write-test assertion, and several violations of the Java guide. No tests were run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Deploy pipeline] --> B{S3 configured?}
    B -->|Yes| C[Turn on log uploads and save flag]
    B -->|No| D[Keep pipeline flag]
    C --> E[Agent uploads logs]
    E --> F[Check status-edit or full-edit permission]
    F --> G[S3 open stream, partial file, or final file]
    H[Read run logs] --> I{Run active with uploads enabled, or stored logs exist?}
    I -->|Yes| G
    I -->|No| J[Read from runner]
Loading

Reviews (1) · Last reviewed commit: "Fixes #37287: store agent logs in S3 whe..." · Reviewed by Greptile

@manerow
manerow requested a review from tutte as a code owner November 18, 2026 09:37
@manerow manerow added the skip-pr-checks Bypass PR metadata validation check label Nov 18, 2026
@manerow
manerow requested a review from a team as a code owner November 18, 2026 09:37
@gitar-bot

gitar-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

Changing log-write authorization to accept EditIngestionPipelineStatus could let status-only roles submit misleading run logs.

Backport of #37394 to 2.1 that makes S3-configured servers always enable streamable agent logs on deploy, reads each run's logs from where they were written, and lets log writes accept EditIngestionPipelineStatus so the Auto Classification bot can store logs. No issues found.

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

Comment on lines +1700 to +1703
return isS3LogStorageEnabled()
&& isStorageRunKey(runId)
&& ((runGoing && shipsLogsToStorage(pipeline))
|| runLogsStored(pipeline.getFullyQualifiedName(), UUID.fromString(runId)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Redeploy hides active-run logs. A run that started with enableStreamableLogs=false keeps that logging setup. Redeploying its pipeline with S3 configured now saves the flag as true, so this condition sends reads for the still-running old run to S3 without checking whether it uploaded anything. Its logs remain on the runner, but the viewer reads an empty store until the run finishes.

Choose the source using the run’s logging setting, not the pipeline’s latest flag, and cover a redeploy while an older run is still active.

Comment on lines +424 to +425
assertNotEquals(403, statusOfLogWrite(bot, runLogs), botName + " writing logs");
assertEquals(200, statusOfLogWrite(bot, runLogs + "/close"), botName + " closing logs");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Write checks accept unrelated failures. assertNotEquals(403, ...) also passes for a malformed request, a missing route, or an unrelated server error. In particular, moving the write permission check back inside the broad catch would turn a refusal into 500 and still pass this assertion. The successful close check would not catch a write-only regression.

Use working storage and require a successful write with readable content, or check that the expected storage error—not an authorization error—caused the 500.

Comment on lines +623 to +632
private static void runDeploy(Runnable deploy) {
try (MockedConstruction<OpenMetadataConnectionBuilder> connectionBuilder =
Mockito.mockConstruction(
OpenMetadataConnectionBuilder.class,
(builder, context) ->
when(builder.build()).thenReturn(new OpenMetadataConnection()));
MockedStatic<Entity> entity = Mockito.mockStatic(Entity.class)) {
entity
.when(() -> Entity.getEntity(any(EntityReference.class), any(), any(Include.class)))
.thenReturn(mock(ServiceEntityInterface.class));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Deploy tests replace internal code. runDeploy replaces both OpenMetadataConnectionBuilder construction and static calls on Entity. The Java guide says to mock only the repository or external-system boundary through the constructor. These tests instead depend on how deployment finds its collaborators.

Use the real deployment setup in an integration test, or inject the needed boundary so these internal replacements are unnecessary.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +440 to +447
void runLogsAreReadFromWhereTheRunWroteThem(
String scenario,
LogStorageConfiguration.Type storageType,
String runId,
boolean runGoing,
boolean pipelineShipsLogs,
boolean logsStored,
boolean expected)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Test exceeds the argument limit. This new test takes seven arguments, including four booleans whose meaning depends on position. The Java guide sets a maximum of five parameters and requires a parameter object beyond that. Pass a named test-case record so the cases are harder to mix up.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +1734 to +1735
boolean latestRun = latestStatus != null && Objects.equals(runId, latestStatus.getRunId());
PipelineStatus run = latestRun ? latestStatus : ownRunStatus(pipelineFQN, runId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 New bindings omit final. latestRun and run are assigned once but lack final. The Java guide requires final on locals and parameters that do not change. Apply it here and to the other unchanged bindings added in this PR.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +594 to +595
updater.changeDescription.getFieldsUpdated().stream()
.filter(change -> "enableStreamableLogs".equals(change.getName()))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Test strings lack constants. The new assertion uses "enableStreamableLogs" directly in .equals(), and the added cases repeat "svc.agent" throughout the file. The Java guide forbids raw strings in equality checks and requires repeated strings to be named constants. Extract those values so the cases share one definition.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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

Labels

backend skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant