Address the SPEC-018 Phase 1 code review (reports/2026-06-03-spec018-review.md): - Bug 2 (config.rs): stop agent_id churn on every restart. The embedded-config path always wins in Config::load, so the saved agent_id was never read back. Add Config::persisted_agent_id() and reuse a prior id from the TOML; only mint a new UUID when none exists. - Bug 1 (main.rs): remove the non-functional in-process fallback in run_permanent_agent_managed. A managed agent's cak_ store is SYSTEM-only ACL'd, so a non-elevated in-process run cannot authenticate (load_cak permission-denied, or enroll C1 read-back failure). Return an actionable "install elevated" error instead of pretending to provide an agent; update the misleading comments. - Issue 6 (startup.rs): replace the fragile transmute::<HANDLE, HKEY> with the windows crate's typed HKEY out-param; add SAFETY comments. cargo check -p guruconnect --target x86_64-pc-windows-msvc passes clean. Deferred lower-severity items tracked in #8. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4.3 KiB
Session Log — 2026-06-03 — GuruConnect SPEC-018 review validation + fixes
User
- User: Mike Swanson (mike)
- Machine: GURU-5070
- Role: admin
Session Summary
Mike forwarded a thorough external code review of GuruConnect SPEC-018 Phase 1 (managed agent as LocalSystem service host; merge 11af9df) performed by a Grok reviewer persona and written to D:\GrokTools\guru-connect-review-SPEC018.md. Task: look over the project and validate.
Independently validated the two flagged bugs and Issue 6 by reading the actual code (not just relaying). Confirmed all three as real. Added a refinement the review missed: the non-functional managed fallback (Bug 1) does still work for a deprecated legacy-api_key managed binary, but is broken specifically for the modern SPEC-016 enrollment path — sharpening the fix.
Copied the review into the project at reports/2026-06-03-spec018-review.md, claimed a coord lock on guruconnect, created branch fix/spec018-review-bugs, and had the Coding Agent implement the three fixes. cargo check -p guruconnect --target x86_64-pc-windows-msvc passes clean (no errors/warnings). Filed Gitea issue #8 for the deferred lower-severity items. Changes remain uncommitted on the branch pending Mike's PR-vs-direct-to-main decision.
Key Decisions
- Validated, did not rubber-stamp. Read the code at each cited location to confirm Bug 1 (main.rs:496), Bug 2 (config.rs:392), Issue 6 (startup.rs transmute) before acting.
- Bug 1 fix = remove the fallback, surface an elevation error (rather than build a degraded fallback). Matches
install_managed_servicedocs; the managed model is elevated-install. The deprecated legacy-key edge case also errors now — acceptable and honest. - Bug 2 fix = read persisted agent_id from the TOML first, generate only if absent — stops agent_id churn on every restart while keeping machine_uid/cak_ as the stable keys.
- Issue 6 fix = typed
HKEYfrom the windows crate (noHANDLE+transmute).install.rswas already typed (no change). - Deferred Issues 3/4/5/7/8 (hot-path unwraps, panic-guard scope, nits) to Gitea #8 — lower severity, follow-ups.
- No commit yet — branch held for human review of diffs + PR-vs-main choice.
Configuration Changes
In submodule projects/msp-tools/guru-connect (branch fix/spec018-review-bugs, UNCOMMITTED):
agent/src/config.rs— addedConfig::persisted_agent_id(); embedded branch nowagent_id: Self::persisted_agent_id().unwrap_or_else(generate_agent_id); corrected comment.agent/src/main.rs—run_permanent_agent_managed: removedrun_agent_mode(None)fallback, nowerror!+Err(...)requiring elevation; updated doc/inline comments.agent/src/startup.rs— replacedtransmute::<HANDLE,HKEY>withHKEY::default()+&mut hkey; added SAFETY comments.- Created
reports/2026-06-03-spec018-review.md(copy of the external review). - Stray untracked
tmp-spec018.diffleft untouched (from the Grok session).
Commands & Outputs
- Validation greps/reads:
run_permanent_agent_managedat main.rs:482, fallback at :496;Config::loadembedded branch config.rs:382-409 (agent_id: generate_agent_id()unconditional, save() never read back);resolve_agent_credentialmain.rs:515 (load_cak permission_denied guard / enroll C1 read-back). cargo check -p guruconnect --target x86_64-pc-windows-msvc→ Finished clean, no warnings from the changes.- Coord lock id
0cfd6269-4548-46d4-8436-c829e42f79d8(guruconnect / agent/src, ttl 2h, GURU-5070/claude-main).
Pending / Incomplete Tasks
- Awaiting Mike's decision: push branch + open PR (recommended, matches SPEC-018 PR #7 convention) vs. commit straight to
main. - On decision: commit the 3 fixes + the review report, push, (PR/merge), then bump the parent-repo submodule pointer on next
/sync, update the coordguruconnectcomponent, and release lock0cfd6269. - Deferred hardening: Gitea guru-connect#8 (Issues 3/4/5/7/8).