Instrument high-signal failure paths with structured logs - #96
Merged
Conversation
Co-authored-by: polylane[bot] <277585245+polylane[bot]@users.noreply.github.com>
Contributor
Author
|
The |
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.
Generated by Polylane Autofix after
jonnyparris/dodowas connected.Several failure paths across the coding agent, MCP integration, GitHub verify-gate, skill registry, and user control emitted bare
console.*calls with no session or run identifiers; this change routes them through the existing structuredlog()helper and attaches the identifiers available at each site, while narrowing two payloads that would have forwarded raw or opaque data into the log sink.Each step below links to the record behind it.
fix_040247…Before / After
❌ Before: An operator debugging a failed session or workflow saw unstructured console output, often without the session id, run id, repo, or skill identifier needed to correlate the failure to a request. Two paths additionally forwarded a raw GitHub error body or an opaque MCP tool object into the logs.
✅ After: The same failures emit one structured JSON line through the project's existing
log()helper with a constant message and the relevant identifiers in structured fields — session id, MCP server id/name, repo/branch/run id, skill dir/name, fork ids — and the GitHub and MCP paths forward only enumerated, sanitized fields. No new dependencies or logging stack were added.Why this matters
src/github-api.tsverify-gate dispatch/poll failures now includerunId,repo,branch, andstatus, so an operator investigating a stuck PR verify can identify the exact workflow run and HTTP status without replaying the queue or grepping raw console text. -src/coding-agent.tsLLM stream, chat, compaction, artifacts, MCP connect, and sync failures now carrysessionId, so a user-reported broken session can be traced from chat to the underlying failure path in one log query. -src/agentic.ts,src/mcp-client.ts,src/mcp-shared.ts, andsrc/mcp.tsMCP failures now carry MCP id/name and session/fork identifiers, so tool-availability and fork incidents point at the specific server or operation rather than requiring manual tool enumeration. -src/skill-registry.tsskill name mismatch and load failures now carryname,dirName, anddir, so a skill that silently fails to load can be identified by directory without rerunning discovery. -src/user-control.tsSharedIndex token deletion now logs the error object, so a cleanup failure surfaces instead of being silently swallowed.What changed
src/agentic.ts: converted OAuth MCP tool-skip warnings tolog()withserverIdandname; removed forwarding of the fullOAuthToolInfoobject. -src/coding-agent.ts: converted nine bareconsole.*failure sites tolog()withsessionId, count, MCP id/name, error, and stack where available. -src/github-api.ts: converted verify-gate dispatch/poll warnings tolog()withrunId,repo,branch,status; parses GitHub's APImessageinstead of forwarding the raw response body. -src/mcp-client.ts: converted auth-scheme normalization info tolog()withmcpIdandmcpName. -src/mcp-shared.ts: converted service-mode fallback and chat-reply reaction failures tolog()with session, space, and message identifiers plus the error. -src/mcp.ts: converted fork-session artifacts fork failure tolog()withsessionId,newId, and the error. -src/skill-registry.ts: converted skill name mismatch and load failure warnings tolog()with name/directory fields and the error. -src/user-control.ts: converted SharedIndex token-delete warning tolog()with the error.Validation
npm run typecheck— passed. -npm run lint— all modified files are clean; the only remaining errors are pre-existing insrc/chat-monitor-agent.ts(unmodified by this diff). -npx vitest run test/github-actions-unit.test.ts test/mcp-acl-unit.test.ts test/skill-registry-unit.test.ts test/user-control.test.ts— 59 tests passed.Root cause, safety reasoning, and scoping notes
Root cause
The repository already uses
src/logger.ts'slog(level, message, fields)structured JSON helper across most of the codebase; these paths still used bareconsole.*, so operators lost the structured sink and correlation fields. The change routes them through the existing idiom, and the one re-leveled site (syncSessionIndex) gainssessionIdand the error object while remaining a non-fatal warning path.Why it's safe
No secrets or credentials are logged.
src/github-api.tsforwards only GitHub's sanitizedmessagefield, and non-JSON error bodies are omitted rather than logged raw. The opaqueOAuthToolInfoobject is no longer forwarded; onlyserverIdandnameare logged. All log messages are constant strings with dynamic values in structured fields, matching the repository's existinglog()idiom. No new dependencies or logging backends were introduced.package-lock.jsonwas reverted after the local dependency install used for validation, so no lockfile change ships.8 files changed (+110/-33)
src/agentic.ts: modified, +10/-2src/coding-agent.ts: modified, +33/-15src/github-api.ts: modified, +25/-3src/mcp-client.ts: modified, +5/-3src/mcp-shared.ts: modified, +20/-4src/mcp.ts: modified, +5/-1src/skill-registry.ts: modified, +9/-4src/user-control.ts: modified, +3/-1Generated by Polylane.