-
Notifications
You must be signed in to change notification settings - Fork 1
Reviews and fixes #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
8fe599d
Rewrite app around agent sessions
KSemenenko 454dde9
agentees
KSemenenko b3e67a5
Persist local agent history and grain state
KSemenenko 842ad57
Fix chat composer shortcuts and UI lag
KSemenenko 7aa916b
fixes
KSemenenko 4922523
Refine MVUX screens and repair agent builder
KSemenenko 384e30d
Move app config into DotPilot app project
KSemenenko c90d04e
ui updates
KSemenenko ba8320c
more work
KSemenenko de5bea1
refactoring
KSemenenko c1f86ef
new structure
KSemenenko cb20a2a
remove trash
KSemenenko 275c782
cleaning
KSemenenko 780a468
fix buils
KSemenenko cdc2090
clean up
KSemenenko c2dc2b1
tests and fixes
KSemenenko 3d06f1a
more fixes
KSemenenko 4aa3442
Fix agent shell startup and chat flows
KSemenenko 0e46ae0
Add real agent profile editing
KSemenenko d726e4a
Prevent desktop sleep during live sessions
KSemenenko f288004
Add fleet board live session monitor
KSemenenko e3faff0
code and page
KSemenenko 4736732
fix: address PR 84 review comments
KSemenenko 7760167
fix: address remaining PR 84 review threads
KSemenenko abfc231
fix: refresh fleet provider snapshot on reload
KSemenenko 71498c5
fix: stabilize linux snap release packaging
KSemenenko 86f0a89
fix: stabilize provider metadata and hydration startup
KSemenenko 6bd5f26
fix: remove duplicate provider probes in tests
KSemenenko 1be0ed4
fix: harden windows sqlite test cleanup
KSemenenko 341e466
fix: clear sqlite pools before test cleanup
KSemenenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: address remaining PR 84 review threads
- Loading branch information
commit 77601674f16c1e42e6ec25592651ea79d2217e18
There are no files selected for viewing
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
99 changes: 99 additions & 0 deletions
99
DotPilot.Tests/Host/Power/DesktopSleepPreventionServiceTests.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| using System.Diagnostics; | ||
| using DotPilot.Core.ChatSessions; | ||
| using DotPilot.Core.ControlPlaneDomain; | ||
| using Microsoft.Extensions.DependencyInjection; | ||
|
|
||
| namespace DotPilot.Tests.Host.Power; | ||
|
|
||
| public sealed class DesktopSleepPreventionServiceTests | ||
| { | ||
| [Test] | ||
| public async Task ServiceTracksSessionActivityLifecycle() | ||
| { | ||
| if (OperatingSystem.IsLinux() && !CommandExists("systemd-inhibit")) | ||
| { | ||
| Assert.Ignore("systemd-inhibit is not available on this machine."); | ||
| } | ||
|
|
||
| if (OperatingSystem.IsMacOS() && !CommandExists("caffeinate")) | ||
| { | ||
| Assert.Ignore("caffeinate is not available on this machine."); | ||
| } | ||
|
|
||
| var services = new ServiceCollection(); | ||
| services.AddLogging(); | ||
| services.AddSingleton(TimeProvider.System); | ||
| services.AddAgentSessions(new AgentSessionStorageOptions | ||
| { | ||
| UseInMemoryDatabase = true, | ||
| InMemoryDatabaseName = Guid.NewGuid().ToString("N"), | ||
| }); | ||
| services.AddSingleton<DesktopSleepPreventionService>(); | ||
|
|
||
| await using var provider = services.BuildServiceProvider(); | ||
| var monitor = provider.GetRequiredService<ISessionActivityMonitor>(); | ||
| var sleepPrevention = provider.GetRequiredService<DesktopSleepPreventionService>(); | ||
|
|
||
| using var lease = monitor.BeginActivity( | ||
| new SessionActivityDescriptor( | ||
| SessionId.New(), | ||
| "Sleep prevention session", | ||
| AgentProfileId.New(), | ||
| "Sleep agent", | ||
| "Debug Provider")); | ||
|
|
||
| await WaitForAsync(static service => service.IsSleepPreventionActive, sleepPrevention); | ||
|
|
||
| lease.Dispose(); | ||
|
|
||
| await WaitForAsync(static service => !service.IsSleepPreventionActive, sleepPrevention); | ||
| } | ||
|
|
||
| private static async Task WaitForAsync( | ||
| Func<DesktopSleepPreventionService, bool> predicate, | ||
| DesktopSleepPreventionService service) | ||
| { | ||
| var timeoutAt = DateTimeOffset.UtcNow.AddSeconds(5); | ||
| while (DateTimeOffset.UtcNow < timeoutAt) | ||
| { | ||
| if (predicate(service)) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| await Task.Delay(50); | ||
| } | ||
|
|
||
| predicate(service).Should().BeTrue(); | ||
| } | ||
|
|
||
| private static bool CommandExists(string commandName) | ||
| { | ||
| try | ||
| { | ||
| var startInfo = new ProcessStartInfo | ||
| { | ||
| FileName = "sh", | ||
| RedirectStandardOutput = true, | ||
| RedirectStandardError = true, | ||
| UseShellExecute = false, | ||
| CreateNoWindow = true, | ||
| }; | ||
| startInfo.ArgumentList.Add("-c"); | ||
| startInfo.ArgumentList.Add($"command -v {commandName}"); | ||
|
|
||
| using var process = Process.Start(startInfo); | ||
| if (process is null) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| process.WaitForExit(2000); | ||
| return process.ExitCode == 0; | ||
| } | ||
| catch | ||
| { | ||
| return false; | ||
| } | ||
| } | ||
| } |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.