Skip to content

chore(logging): Fix log hygiene findings (Log Hygiene Automation) - #1540

Open
tofarr wants to merge 1 commit into
mainfrom
openhands/log-hygiene/2026-11-24-4e2545
Open

tofarr wants to merge 1 commit into
mainfrom
openhands/log-hygiene/2026-11-24-4e2545

Conversation

@tofarr

@tofarr tofarr commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Why

This is the scheduled log hygiene pass. It fixes 56 of 60 preformatted-message findings in three files. Messages built with f-strings are now constant sentences, and the values are passed as extra with snake_case keys (provider, source, org_id, user_id, issue_key, conversation_id, webhook_id, and so on). Values moved to extra appear in JSON log output but not in plain-text output.

  • server/services/automation_event_service.py: 32 of 36 findings fixed.
  • integrations/jira_dc/jira_dc_manager.py: 22 of 22 fixed.
  • integrations/azure_devops/azure_devops_view.py: 2 of 2 fixed.
  • Handlers that format a caught exception, do not re-raise and have one log call now pass exc_info=True instead of putting the error in the message (14 calls: 6 in automation_event_service.py, 8 in jira_dc_manager.py). I used exc_info=True rather than logger.exception(...) so the WARNING/DEBUG level stays unchanged, as the level rule requires.
  • Some messages became identical once they were constant, so the checker flagged them as non-unique. I reworded them to stay distinguishable: Invalid event detection rule in requested metadata in automation_event_service.py, and Webhook workspace is not active / Job workspace is not active in jira_dc_manager.py.
  • INFO to DEBUG changes: none.

Calls left alone with # log-hygiene: ignore, because the message carries a whole downstream response body and that must not go in extra:

  • automation_event_service.py: warning Failed to fetch requested event types for {source}: {resp.status} {body}
  • automation_event_service.py: warning Invalid requested event metadata response for {source}: {data}
  • automation_event_service.py: error Automation service returned {resp.status} ... {body} (5xx branch)
  • automation_event_service.py: error Automation service returned {resp.status} ... {body} (4xx branch)

Test update: tests/unit/server/routes/test_org_git_claims.py asserted on text inside the logged message. It now asserts on the extra values.

Validation

  • log_checks.py (from extensions-private@main) on the three files: 60 findings before, 0 findings and exit 0 after.
  • Unit tests for test_org_git_claims.py, test_automation_event_service.py, tests/unit/integrations/jira_dc and tests/unit/integrations/azure_devops: 316 passed. 21 tests could not run: they need the Postgres test container, and Docker cannot start in this sandbox (no root). They fail the same way on unmodified main, so CI should confirm them.

This pull request was opened by an AI agent (OpenHands).


Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-fc7ed02

@tofarr tofarr added the ignore-for-release Left out of release notes label Nov 24, 2026
@tofarr
tofarr requested a review from all-hands-bot November 24, 2026 17:20
@github-actions github-actions Bot added the type: chore Maintenance / chores label Nov 24, 2026
@all-hands-bot

all-hands-bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Review paused: current-head checks did not pass

The current head fc7ed022566e has checks that did not pass, so no review conversation was started:

  • Lint python

Fix the checks above and push. The scheduled scan then starts the review on the updated head.

This is an automated check - no AI was used to generate this comment.

Comment on lines +109 to +112
extra={
'provider': provider.value,
'provider_user_id': provider_user_id,
},
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/jira_dc
  jira_dc_manager.py 670, 860
  server/services
  automation_event_service.py 476, 488, 699
Project Total  

This report was generated by python-coverage-comment-action

This branch has not been deployed

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

Labels

ignore-for-release Left out of release notes type: chore Maintenance / chores

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants