Skip to content

Return log store errors to the agent, except for duplicate entries - #7501

Merged
6543 merged 3 commits into
woodpecker-ci:mainfrom
hsdfat:fix/log-append-errors-7085
Nov 7, 2026
Merged

6543 merged 3 commits into
woodpecker-ci:mainfrom
hsdfat:fix/log-append-errors-7085

Conversation

@hsdfat

@hsdfat hsdfat commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Closes #7085

This follows the shape suggested in #7085 (comment): only a duplicate insert error is dropped, everything else goes back to the agent as before #7004.

  • RPC.Log returns the LogAppend error unless it is types.ErrInsertDuplicateDetected (entries resent after a retry, rejected by the unique index from Enforce one log entry per line with a unique index #7004).
  • WoodpeckerServer.Log no longer discards the error of every step run but the last in a request. It returns them joined with errors.Join.
  • TestLogAppendRejectsResentEntries now asserts ErrorIs(..., types.ErrInsertDuplicateDetected), since RPC.Log relies on that.

Not changed: the agent still treats these errors as permanent (codes.Unknown), so it logs them and drops the batch. The loss is visible now but not retried. I left retry classification and the "lines lost" marker out, since they weren't agreed in the issue.

Two cases worth knowing:

  • datastore.LogAppend joins one error per chunk. If a single request spans several chunks and one is a duplicate while another fails for a real reason, errors.Is matches the duplicate and the request is still treated as stored. I kept the check simple rather than walking the joined errors. Happy to change it if you'd rather cover that.
  • The addon log store passes errors over net/rpc as strings, so a duplicate there is not recognised and is now returned to the agent instead of being swallowed.

Tests: go test -race ./server/rpc/ ./server/store/datastore/, and golangci-lint v2.15.0 on both packages. TestRPCLogAppendError/store_error_is_returned and TestServerLogReportsEveryStepError fail on main.

@6543 6543 added bug Something isn't working server labels Nov 7, 2026
@6543

6543 commented Nov 7, 2026

Copy link
Copy Markdown
Member

ci fails ...

@hsdfat

hsdfat commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. It was cspell on the word "resends" in a comment; reworded in 85c4b28. Lint and tests were green.

@codecov

codecov Bot commented Nov 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.09%. Comparing base (862547c) to head (5a5469c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7501      +/-   ##
==========================================
+ Coverage   66.07%   66.09%   +0.02%     
==========================================
  Files         449      449              
  Lines       22388    22391       +3     
==========================================
+ Hits        14792    14800       +8     
+ Misses       7596     7591       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@6543
6543 merged commit f620595 into woodpecker-ci:main Nov 7, 2026
9 checks passed
@woodpecker-bot woodpecker-bot mentioned this pull request Nov 7, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Log lines can be dropped silently: LogAppend errors are swallowed and Log RPC errors are classified permanent

2 participants