Hotfix/machine id header - #96
Conversation
…ame mode Ports the March feature/machine-id-header work onto current main: a cached provider reads the shared OpenFrame machine_id file written by openframe-client, and orbit stamps it on every request alongside the bearer token. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> # Conflicts: # client/orbit_client.go
WalkthroughOpenFrame mode now creates and stores an 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/service/openframe/openframe_machine_id_provider.go`:
- Around line 41-42: Update OpenFrameMachineIdProvider.GetMachineId around the
initial read so an empty, non-configured machine ID is not permanently cached:
re-read the file when the cached value is blank, or invoke Refresh at an
appropriate lifecycle point before requests depend on x-machine-id. Preserve
normal caching for valid IDs and configured values.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6d46d40e-830f-4ceb-a76c-21fc82fdb9c3
⛔ Files ignored due to path filters (1)
openframe/docs/agent-openframe-mode.mdis excluded by!**/*.md
📒 Files selected for processing (2)
client/orbit_client.goserver/service/openframe/openframe_machine_id_provider.go
| p.machineId = p.readFromFile() | ||
| p.initialized = true |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect OrbitClient methods for an explicit refresh lifecycle.
ast-grep outline client/orbit_client.go --items all --type function,method --view expanded
rg -n -C 3 '\bmachineIdProvider\.Refresh\s*\(' client/orbit_client.go
# Locate direct refresh invocations for the provider implementation.
rg -n -C 3 '\bOpenFrameMachineIdProvider\b|\bRefresh\s*\(' --glob '*.go'Repository: flamingo-stack/fleetmdm
Length of output: 3379
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map and inspect the provider and OrbitClient machine-ID related code.
sed -n '1,120p' server/service/openframe/openframe_machine_id_provider.go
printf '\n--- client/orbit_client.go machine-id snippets ---\n'
rg -n -C 5 'machineIdProvider|OpenFrameMachineIdProvider|GetMachineId|NewOpenFrameMachineIdProvider|x-machine-id|Machine' server/service/openframe/openframe_machine_id_provider.go client/orbit_client.go || true
printf '\n--- all Refresh calls in Go files ---\n'
rg -n -C 3 '\.Refresh\s*\(' . --glob '*.go' || trueRepository: flamingo-stack/fleetmdm
Length of output: 13584
Add a recover path for empty cached machine IDs.
OpenFrameMachineIdProvider.GetMachineId() caches "" after the first file read if the file is missing, unreadable, or contains only whitespace. No production code calls the provider’s Refresh, but existing requests omit x-machine-id when the cache is empty. Force a re-read when the first non-configured cached value is blank, or call Refresh at a lifecycle point where the file can become available before later requests depend on the header.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@server/service/openframe/openframe_machine_id_provider.go` around lines 41 -
42, Update OpenFrameMachineIdProvider.GetMachineId around the initial read so an
empty, non-configured machine ID is not permanently cached: re-read the file
when the cached value is blank, or invoke Refresh at an appropriate lifecycle
point before requests depend on x-machine-id. Preserve normal caching for valid
IDs and configured values.
Summary by CodeRabbit
New Features
Bug Fixes