fix: write ERROR/WARN to daily log even when debug is off - #311
Merged
Conversation
📦 Built Plugin ArtifactBranch: Option A — Install from npm PR tag (recommended)opencode plugin opencode-acp@pr-311 --globalEach push to this PR publishes a new version under the Option B — Install from GitHubopencode plugin "github:ranxianglei/opencode-acp#2026-08-16_default-error-logging" --globalOption C — Download artifact
tar xzf opencode-acp-pr311.tgz
cp -r package/dist ~/.cache/opencode/packages/opencode-acp@latest/node_modules/opencode-acp/dist
This comment is automatically updated on each push. |
Since PR #311 Logger writes WARN/ERROR to the daily log even when debug is off, test files creating module-scope new Logger(false) without redirecting XDG_CONFIG_HOME leaked log lines into the developer's real config home during npm test (9 lines per full-suite run, verified). Add tests/test-env.ts (redirects XDG_CONFIG_HOME/XDG_DATA_HOME to mkdtemp dirs on import) and import it first in the 15 affected files.
apply.ts Phase 1 calls filters inside a messages×parts×filters loop; with WARN now always persisted (PR #311), a broken filter would write one daily-log line per message×part per turn. Dedupe by filter name per pass. Add regression test: 5 messages × always-throwing filter → exactly 1 warn.
- README/CONFIGURATION (en+zh)/AGENTS: debug now gates INFO/DEBUG +
context snapshots only; WARN/ERROR always land in daily/<date>.log
- e2e-tier-compression: two new Logger({level:'error'}) sites passed an
object (truthy → debug-enabled); use new Logger(false) as intended
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With the default
debug: false, the Logger wrote no log files at all — so when a user's task errors out there is zero on-disk evidence. Users had to enabledebug: true(which also enables heavy per-request context snapshots) to get any logs.Change
lib/logger.ts: the enable gate moved intowrite()per level — ERROR and WARN lines are now appended to~/.config/opencode/logs/acp/daily/<date>.logby default; INFO/DEBUG and per-request context snapshots stay gated behinddebug: true.tests/logger.test.ts(new): 4 tests covering disabled/enabled logger across all levels and the log line format.Verification
npx tsc --noEmitcleannpm run buildOKscripts/ci/check-pr.sh) all passedCompatibility
No persisted-state, config-schema, or exported-API changes. WARN/ERROR call sites are all rare anomaly paths, so default daily-log volume stays tiny.