Implement the following plan: Fix: Review feedback — logging, docs, and performance…
- User
Implement the following plan:
Fix: Review feedback — logging, docs, and performance
Context
Three improvements from code review: add debug logging for silenced errors, document intentional behavior for terminal agent auto-linking, and optimize
isFileModificationToolwith a map lookup.Changes
1. Add debug logging for best-effort transcript errors
File:
cmd/entire/cli/agent/kiro/lifecycle.go(lines 156, 160)- Replace
//nolint:errchecksuppressed errors withlogging.Debugcalls - The
loggingpackage is already imported - Keep the fallthrough behavior — just add visibility
go// Line 156: ensureCachedTranscript sessionRef, err := k.ensureCachedTranscript(ctx, cwd, sessionID) if err != nil { logging.Debug(ctx, "kiro: ensureCachedTranscript failed (best-effort)", slog.String("error", err.Error())) } // Line 160: ensureIDETranscript sessionRef, err = k.ensureIDETranscript(ctx, cwd, sessionID) if err != nil { logging.Debug(ctx, "kiro: ensureIDETranscript failed (best-effort)", slog.String("error", err.Error())) }Need to add
"log/slog"to imports.2. Add inline comment documenting terminal agent auto-link behavior
File:
cmd/entire/cli/strategy/manual_commit_hooks.go(lines 364-377)The existing comment block (lines 364-377) already documents the behavior well. Add one sentence clarifying that manual user commits while a terminal agent is active will also auto-link (non-destructive, trailer is removable via prepare-commit-msg).
3. Optimize
isFileModificationToolwith map lookupFile:
cmd/entire/cli/agent/kiro/transcript.go- Convert
kiroFileModificationToolsfrom[]stringtomap[string]struct{} - Simplify
isFileModificationToolto a single map lookup - Update
extractFilesFromAssistantcall site (no change needed — it callsisFileModificationTool)
- Replace
Assistant
★ Insight ─────────────────────────────────────This plan applies three common code review patterns: (1) replacing silenced errors with debug logging for observability without changing control flow, (2) documenting intentional behavior to prevent future "is this a bug?" questions, and (3) converting linear search to O(1) map lookup — a micro-optimization that also improves readability.─────────────────────────────────────────────────Let me read the three files that need changes.
Assistant
Let me read the relevant section of the hooks file.
Assistant
Now I have all the context. Let me apply the three changes.
Assistant
All three changes applied. Now let me verify.
Assistant
The
sessionRefvariable is no longer declared since I changed_toerr(which was already declared). I need to declaresessionRefexplicitly.Assistant
Need to declare
sessionRefas a variable before the first assignment. The original code used:=which implicitly declared it; now with=it needs an explicitvar.Assistant
Lint passes. Now run tests.
Assistant
All tests pass. Here's a summary of the three changes:
-
lifecycle.go— Replaced//nolint:errchecksuppressions withlogging.Debugcalls forensureCachedTranscriptandensureIDETranscript. Addedlog/slogimport and explicitvar sessionRef stringdeclaration. -
manual_commit_hooks.go— Added an inline comment clarifying that manual user commits during an active terminal agent session also auto-link via the fast path, and that this is intentional since the trailer is removable. -
transcript.go— ConvertedkiroFileModificationToolsfrom[]stringtomap[string]struct{}and simplifiedisFileModificationToolto a single map lookup.
★ Insight ─────────────────────────────────────-
- User
commit
Assistant
There's a
review-01.mdfile staged that looks unrelated. Let me commit only the three changed files.Assistant
Committed as
b4d27bb6. Thereview-01.mdfile was left unstaged since it's not part of this change.- User
commit
Assistant
There are no staged changes to commit — the only uncommitted file is
review-01.md(untracked). Would you like me to commit that file?- User
check again
Assistant
There's one modified file:
.github/workflows/e2e.yml. Want me to commit that, or was there something else you expected to see?- User
yes
Assistant
Committed as
bbaf6a11— addskiroto the E2E workflow's agent dispatch options.