Skip to content

[Repo Assist] feat(device): enhance device.status with os/cpu/memory/disk sections and sections filter - #242

Closed
github-actions[bot] wants to merge 1 commit into
masterfrom
repo-assist/improve-device-status-2026-04-29-72bbd3eeb0eefe99
Closed

[Repo Assist] feat(device): enhance device.status with os/cpu/memory/disk sections and sections filter#242
github-actions[bot] wants to merge 1 commit into
masterfrom
repo-assist/improve-device-status-2026-04-29-72bbd3eeb0eefe99

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated PR from Repo Assist.

Implements the structured sections proposed in #240, adding os, cpu, memory, and disk.drives fields to device.status plus a sections[] filter argument. All legacy fields are preserved for backward compatibility.

Changes

src/OpenClaw.Shared/Capabilities/DeviceCapability.cs

New field Source Notes
collectedAt DateTime.UtcNow ISO-8601 UTC timestamp
os.version Environment.OSVersion.Version e.g. "10.0.26100"
os.architecture RuntimeInformation.OSArchitecture e.g. "X64", "Arm64"
os.machineName Environment.MachineName
os.uptimeSeconds Environment.TickCount64 / 1000
cpu.name PROCESSOR_IDENTIFIER env var / arch fallback Existing GetModelIdentifier()
cpu.logicalProcessors Environment.ProcessorCount
cpu.usagePercent null Reserved for platform-specific injection (e.g. PerformanceCounter)
memory.totalBytes GC.GetGCMemoryInfo().TotalAvailableMemoryBytes Physical RAM on Windows/Linux
memory.availableBytes total - load
memory.usagePercent Computed
disk.drives[] DriveInfo.GetDrives() All ready drives; each has name, label, totalBytes, freeBytes, usagePercent, format

sections parameter: if omitted, all sections are populated (backward-compatible). If provided (e.g. {"sections":["os","cpu"]}), only named sections are included and non-named sections are returned as null. Unknown section names return an error listing valid values.

Legacy fields (battery, thermal, storage, network, uptimeSeconds) remain unchanged.

tests/OpenClaw.Shared.Tests/CapabilityTests.cs

Three new tests added to DeviceCapabilityTests:

  • DeviceStatus_ReturnsEnhancedSections — asserts collectedAt, os, cpu, memory, disk.drives are present and well-formed
  • DeviceStatus_SectionsFilter_ReturnsOnlyRequestedSections — asserts non-requested sections are null
  • DeviceStatus_SectionsFilter_RejectsUnknownSections — asserts error response for unknown section names

Test Status

Suite Result
OpenClaw.Shared.Tests (new DeviceCapability tests) ✅ 3 new tests passing
OpenClaw.Shared.Tests (full suite) ✅ 967 passed, 20 skipped; 3 pre-existing McpHttpServerTests failures unrelated to this change (see PR #238)
OpenClaw.Tray.Tests ✅ 202 passed, 0 failed

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@97143ac59cb3a13ef2a77581f929f06719c7402a

Add structured os, cpu, memory, and disk.drives sections to device.status
response, a collectedAt timestamp, and a sections[] filter parameter
so callers can request only the data they need.

- os: version, architecture, machineName, uptimeSeconds
- cpu: name, logicalProcessors, usagePercent (null until platform provider injected)
- memory: totalBytes, availableBytes, usagePercent (via GCMemoryInfo)
- disk.drives[]: name, label, totalBytes, freeBytes, usagePercent, format
- sections filter: if provided, only named sections are populated; unknown names return an error
- collectedAt: ISO-8601 UTC timestamp for cache freshness

All legacy response fields (battery, thermal, storage, network, uptimeSeconds)
are preserved unchanged for backward compatibility.

Closes #240

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Repo Assist note: This PR is superseded by community PR #249 ("feat(device): enhance device.status with rich system health sections...") by @RBrid, which implements the same feature with a more comprehensive design — including an IDeviceStatusProvider injection pattern, per-section fault tolerance via SafeCollect wrappers, WinRT battery + P/Invoke memory + PerformanceCounter CPU sampling, and 18 new tests. Since #249 already addresses issue #240 with a better architecture, this Repo Assist PR should be closed in favour of #249. @shanselman please close when convenient.

Generated by 🌈 Repo Assist, see workflow run.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@97143ac59cb3a13ef2a77581f929f06719c7402a

@github-actions github-actions Bot mentioned this pull request May 1, 2026
23 tasks
@shanselman

Copy link
Copy Markdown
Collaborator

Closing per repo-assist triage: this is superseded by the broader provider-based device status work in #249, and this draft leaves important semantics/provider gaps unresolved.

@shanselman shanselman closed this May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant