Compare commits

...
Author SHA1 Message Date
poli0981andClaude Opus 5.5 755806a0c7 fix(app): a request the capture agent never answered is said in words and the page reads what is stored - never a crash dialog or an exception's name (beta.22 PR-1)
The owner (2026-10-13, during beta.21): "make the chip a new PR after the
release, and a new version". The chip came from beta.21's review of Play
(#304): when the pipe closes, PipeClient fails a request in flight with what
ended its reader - an IOException, an IpcFramingException or an
ObjectDisposedException - and a client AgentConnection disposed between its
check and the write throws the last.

What each caller did, read in the code:
- SessionDeletion caught no IOException: deleting sessions while the agent
  stopped or restarted for an update ended in the App's crash dialog (an
  exception out of a command); a timeout showed its own message.
- HookingConsent and AntiCheatExceptions caught IOException and
  TimeoutException as Failed with the exception's type name as the detail:
  the game page's notice read "IOException".
- Every caller missed IpcFramingException and ObjectDisposedException.
- GamePlayer (beta.21) caught them all and said "the agent is not running",
  which is untrue when the launch may have run.

Changes:
- AgentConnection.RequestAsync answers through AnsweredAsync: an
  IpcFramingException or ObjectDisposedException becomes ONE IOException
  ("the connection to the Agent closed before it answered", the original as
  its inner exception). IAgentRequests names the four ways a request fails.
  RefreshStatusAsync also catches IpcFramingException.
- AgentAnswers.IsUnanswered (IOException or TimeoutException): whether the
  request was carried out is not known.
- SessionDeletion, HookingConsent, AntiCheatExceptions and GamePlayer tell
  the three apart: InvalidOperationException = not connected, nothing was
  sent (AgentUnavailable, in their existing words); unanswered = a new
  Unanswered outcome, said with one new string, Agent_Unanswered (en/vi/ja,
  ja marked review); IpcRequestException as before. An unanswered delete
  also lets go of what named a deleted session (it may have run), and an
  ack without its counts is unanswered too. The game page reads what is
  stored after an unanswered delete, and Settings re-reads its hooked games
  after an unanswered revoke; the consent and exception paths already
  re-read the page.
- 07_IPC section Client behavior; CHANGELOG.

Tests: AgentConnectionTests.EveryWayThePipeClosesUnderARequestIsOneIOException;
SessionDeletionAndOverviewTests.ADeleteTheAgentNeverAnsweredIsSaidAsNotKnownAndThePageReadsWhatIsStored
(a delete that ran and lost its answer: the page empties and the selection
lets go); HookingConsentTests.AnAskTheAgentNeverAnsweredIsNotKnownAndOneNeverSentIsNoAgent;
AntiCheatExceptionsTests.AnAskTheAgentNeverAnsweredIsNotKnownAndSaidInWords;
GamePlayerTests.AnAnswerThatNeverCameIsNotKnownAndARequestNeverSentIsNotRunning
(replaces beta.21's "not running").

Gate: ./build.ps1 ALL GATES PASSED (291 s); App 619. The owner's live rules
files were pre-seeded and restored byte for byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 21:24:43 +07:00
26 changed files with 315 additions and 38 deletions

No files matched your search

+9
View File
@@ -28,6 +28,15 @@ numeric core and does not move; the heading is the full version — corrected 20
## [Unreleased]
### Fixed
- **A request the capture agent never answered is said as such, never as a crash.** When the agent stopped, or restarted
for an update, while FrameLedger was asking it something, deleting sessions ended in the crash dialog, and turning a
game's hooking on or off or making or withdrawing an anti-cheat exception showed *IOException* or *TimeoutException* as
its notice. Each now says that the agent did not answer and that whether it was done is not known, and the page shows
what is stored; Play says the same (it said the agent was not running). A request that could not be sent because the
agent was already gone still says that nothing was changed (`docs/07_IPC.md` §Client behavior).
## [0.1.0-beta.21] - 2026-10-13
**The twenty-first pre-release: an anti-cheat kept beside a game's executable found before anything is injected, four
+9
View File
@@ -482,6 +482,15 @@ message, and that message always re-scans.
and SYSTEM) each carry an explicit descriptor. The instance lock and the elevation marker are only ever probed, and a
probe that is refused reads as "held".
- Treat the pipe as unreliable: library, history and charts must all work with the Agent offline. Only live status degrades.
- **A request the Agent never answered is neither a failure nor a refusal (beta.22).** `IAgentRequests.RequestAsync` fails
in one of four ways: `InvalidOperationException` — not connected, nothing was sent; `IpcRequestException` — the Agent
answered `Error`; `TimeoutException`; and `IOException` — the connection closed before the answer, whatever closed it
(`AgentConnection.AnsweredAsync` turns the `IpcFramingException` and `ObjectDisposedException` that `PipeClient` can fail a
request in flight with into it, so a caller handles one). The last two mean *whether it was carried out is not known*
(`AgentAnswers.IsUnanswered`): the caller says so in words (`Agent_Unanswered`) and reads what is stored again — deleting
sessions, the hooking switch, the anti-cheat exception and Play alike. Until beta.22 deleting sessions caught no
`IOException` (the App's crash dialog) and showed a timeout's own message, and the hooking switch and the exception
showed `IOException` or `TimeoutException` as their notice.
- SQLite is the source of truth for anything persisted; pipe events are refresh signals (except `SessionProgress`, which is live-only by design).
- `CaptureRefused`, `SafetyUnhook` and (since 2026-09-25) `HookingTurnedOff` are **never** collapsed into a generic error toast — they get dedicated, explanatory UI (`08_UI` §Notifications).
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
namespace FrameLedger.App.Services;
/// <summary>
/// beta.22: a request the capture agent never answered, told apart from one it refused and from one never sent. The
/// connection closed under it (<see cref="IOException"/>, <see cref="AgentConnection.AnsweredAsync"/>) or no answer came in
/// time (<see cref="TimeoutException"/>): whether it was carried out is not known, so a caller says so
/// (<c>Agent_Unanswered</c>) and reads what is stored again rather than assuming either way (<c>07_IPC</c> §Client behavior).
/// An <see cref="InvalidOperationException"/> from the request is the connection gone before it was sent: nothing was asked.
/// </summary>
public static class AgentAnswers
{
public static bool IsUnanswered(Exception ex) => ex is IOException or TimeoutException;
}
@@ -108,7 +108,27 @@ public sealed class AgentConnection : IAgentLink, IAsyncDisposable
throw new InvalidOperationException("the Agent is not connected");
}
return client.RequestEnvelopeAsync(type, payload, _options.RequestTimeout, ct);
return AnsweredAsync(() => client.RequestEnvelopeAsync(type, payload, _options.RequestTimeout, ct));
}
/// <summary>
/// beta.22: a request's answer, with every way the pipe can close under it said as ONE <see cref="IOException"/>.
/// <see cref="PipeClient"/> fails a request in flight with what ended its reader — an <see cref="IOException"/>, an
/// <see cref="IpcFramingException"/> or an <see cref="ObjectDisposedException"/> — and a client this connection disposed
/// between the check above and the write throws the last; a caller that knew only the first ended in the App's crash
/// dialog (beta.21's review of Play). <see cref="IAgentRequests.RequestAsync{TRequest}"/> names what is left.
/// </summary>
internal static async Task<IpcEnvelope> AnsweredAsync(Func<Task<IpcEnvelope>> request)
{
ArgumentNullException.ThrowIfNull(request);
try
{
return await request().ConfigureAwait(false);
}
catch (Exception ex) when (ex is ObjectDisposedException or IpcFramingException)
{
throw new IOException("the connection to the Agent closed before it answered", ex);
}
}
/// <summary>Ask the Agent for its status now; null when not connected or when the request failed.</summary>
@@ -126,7 +146,7 @@ public sealed class AgentConnection : IAgentLink, IAsyncDisposable
Set(AgentConnectionState.Connected, Hello, status);
return status;
}
catch (Exception ex) when (ex is IOException or TimeoutException or IpcRequestException or ObjectDisposedException)
catch (Exception ex) when (ex is IOException or TimeoutException or IpcRequestException or ObjectDisposedException or IpcFramingException)
{
return null;
}
@@ -27,6 +27,9 @@ public enum AntiCheatExceptionOutcome
/// <summary>No connected Agent; nothing was sent.</summary>
AgentUnavailable,
/// <summary>The Agent answered and did not grant (a store outcome, an <c>Error</c>, a timeout); <c>Detail</c> says which.</summary>
/// <summary>The Agent answered and did not grant (a store outcome, an <c>Error</c>); <c>Detail</c> says which.</summary>
Failed,
/// <summary>beta.22: the Agent did not answer (<see cref="AgentAnswers.IsUnanswered"/>): whether it granted or withdrew is not known.</summary>
Unanswered,
}
@@ -27,6 +27,7 @@ public sealed record AntiCheatExceptionResult(AntiCheatExceptionOutcome Outcome,
// A grant and a withdrawal alike (beta.18): "Nothing was enabled." was the hooking consent's words, untrue for a withdrawal.
AntiCheatExceptionOutcome.AgentUnavailable => Strings.Agent_NotConnected_NothingChanged,
AntiCheatExceptionOutcome.Failed => Detail ?? Strings.Common_NotAvailable,
AntiCheatExceptionOutcome.Unanswered => Strings.Agent_Unanswered,
_ => null,
};
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
using FrameLedger.Infrastructure.Ipc;
using FrameLedger.Shared.Ipc;
using FrameLedger.Shared.Safety;
@@ -66,17 +65,28 @@ public sealed class AntiCheatExceptions
IpcEnvelope ack = await _agent.RequestAsync(IpcMessageType.SetAntiCheatException, request, ct).ConfigureAwait(true);
return Interpret(ack, request.Enabled);
}
catch (Exception ex) when (ex is IpcRequestException or TimeoutException or IOException or InvalidOperationException)
catch (IpcRequestException ex)
{
Log.Warning(ex, "exception: SetAntiCheatException(game {GameId}, {Enabled}) did not complete", request.GameId, request.Enabled);
string? code = (ex as IpcRequestException)?.Code;
AntiCheatExceptionOutcome outcome = code switch
AntiCheatExceptionOutcome outcome = ex.Code switch
{
IpcErrorCode.DisclosureVersionMismatch => AntiCheatExceptionOutcome.VersionMismatch,
IpcErrorCode.ExceptionsOff => AntiCheatExceptionOutcome.OptionOff,
_ => AntiCheatExceptionOutcome.Failed,
};
return new AntiCheatExceptionResult(outcome, code ?? ex.GetType().Name);
return new AntiCheatExceptionResult(outcome, ex.Code ?? IpcMessageType.Error);
}
catch (InvalidOperationException ex)
{
// The connection went between the caller's check and the request: nothing was sent.
Log.Warning("exception: SetAntiCheatException(game {GameId}, {Enabled}) was not sent ({Message})", request.GameId, request.Enabled, ex.Message);
return AntiCheatExceptionResult.Of(AntiCheatExceptionOutcome.AgentUnavailable);
}
catch (Exception ex) when (AgentAnswers.IsUnanswered(ex))
{
// beta.22: whether the exception was made or withdrawn is not known — never the exception's type name as the notice.
Log.Warning(ex, "exception: SetAntiCheatException(game {GameId}, {Enabled}) had no answer", request.GameId, request.Enabled);
return AntiCheatExceptionResult.Of(AntiCheatExceptionOutcome.Unanswered);
}
}
+11 -5
View File
@@ -2,7 +2,6 @@
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Globalization;
using System.IO;
using System.Text.Json;
using FrameLedger.Application.Import;
using FrameLedger.Application.Persistence;
@@ -104,6 +103,7 @@ public sealed class GamePlayer
_ => string.Format(CultureInfo.CurrentCulture, Strings.Play_Started_Format, gameName),
}, false),
PlayOutcome.AgentUnavailable => (string.Format(CultureInfo.CurrentCulture, Strings.Play_AgentUnavailable_Format, gameName), true),
PlayOutcome.Unanswered => (Strings.Agent_Unanswered, true),
// "Set Play to go through the store" only where Play was not already going through it.
PlayOutcome.RecordingOff => (string.Format(CultureInfo.CurrentCulture,
result.Fallback == PlayFallback.None ? Strings.Play_RecordingOff_Format : Strings.Play_RecordingOff_Fallback_Format, gameName), true),
@@ -171,13 +171,19 @@ public sealed class GamePlayer
IpcEnvelope envelope = await _agent.RequestAsync(IpcMessageType.LaunchGame, new LaunchGameRequest(game.Id, null), ct).ConfigureAwait(false);
ack = IpcCodec.Payload<LaunchAck>(envelope);
}
catch (Exception ex) when (ex is InvalidOperationException or TimeoutException or IOException or ObjectDisposedException or IpcFramingException)
catch (InvalidOperationException ex)
{
// The connection went between the check above and the answer — the agent stopping, or restarting for an update:
// the pipe fails a request in flight with these (PipeClient), and a press never ends in an unhandled exception.
Log.Warning("play: LaunchGame for {Game} (id {Id}) had no answer ({Kind}: {Message})", game.Name, game.Id, ex.GetType().Name, ex.Message);
// The connection went between the check above and the request: nothing was sent.
Log.Warning("play: LaunchGame for {Game} (id {Id}) was not sent ({Message})", game.Name, game.Id, ex.Message);
return new PlayResult(PlayOutcome.AgentUnavailable, Fallback: fallback);
}
catch (Exception ex) when (AgentAnswers.IsUnanswered(ex))
{
// The agent stopping or restarting under the request, or no answer in time (beta.22): whether the game is starting
// is not known — and a press never ends in an unhandled exception (beta.21's review).
Log.Warning("play: LaunchGame for {Game} (id {Id}) had no answer ({Kind}: {Message})", game.Name, game.Id, ex.GetType().Name, ex.Message);
return new PlayResult(PlayOutcome.Unanswered, Fallback: fallback);
}
catch (Exception ex) when (ex is IpcRequestException or JsonException)
{
Log.Warning("play: LaunchGame for {Game} (id {Id}) failed ({Kind}: {Message})", game.Name, game.Id, ex.GetType().Name, ex.Message);
+14 -3
View File
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
using FrameLedger.Infrastructure.Ipc;
using FrameLedger.Shared.Ipc;
using FrameLedger.Shared.Safety;
@@ -65,14 +64,26 @@ public sealed class HookingConsent
IpcEnvelope ack = await _agent.RequestAsync(IpcMessageType.SetHookEnabled, request, ct).ConfigureAwait(true);
return Interpret(ack, request.Enabled, onWritten);
}
catch (Exception ex) when (ex is IpcRequestException or TimeoutException or IOException or InvalidOperationException)
catch (IpcRequestException ex)
{
Log.Warning(ex, "consent: SetHookEnabled(game {GameId}, {Enabled}) did not complete", request.GameId, request.Enabled);
string detail = ex is IpcRequestException ipc ? ipc.Code ?? IpcMessageType.Error : ex.GetType().Name;
string detail = ex.Code ?? IpcMessageType.Error;
return new HookingConsentResult(
string.Equals(detail, IpcErrorCode.DisclosureVersionMismatch, StringComparison.Ordinal) ? HookingConsentOutcome.VersionMismatch : HookingConsentOutcome.Failed,
detail);
}
catch (InvalidOperationException ex)
{
// The connection went between the caller's check and the request: nothing was sent.
Log.Warning("consent: SetHookEnabled(game {GameId}, {Enabled}) was not sent ({Message})", request.GameId, request.Enabled, ex.Message);
return HookingConsentResult.Of(HookingConsentOutcome.AgentUnavailable);
}
catch (Exception ex) when (AgentAnswers.IsUnanswered(ex))
{
// beta.22: whether the Agent stamped or revoked is not known — never the exception's type name as the notice.
Log.Warning(ex, "consent: SetHookEnabled(game {GameId}, {Enabled}) had no answer", request.GameId, request.Enabled);
return HookingConsentResult.Of(HookingConsentOutcome.Unanswered);
}
}
private static HookingConsentResult Interpret(IpcEnvelope ack, bool enabling, HookingConsentOutcome onWritten)
@@ -24,6 +24,9 @@ public enum HookingConsentOutcome
/// <summary>No connected Agent; nothing was sent.</summary>
AgentUnavailable,
/// <summary>The Agent answered but did not stamp (a store outcome other than <c>Written</c>, an <c>Error</c>, a timeout); <c>Detail</c> says which.</summary>
/// <summary>The Agent answered but did not stamp (a store outcome other than <c>Written</c>, an <c>Error</c>); <c>Detail</c> says which.</summary>
Failed,
/// <summary>beta.22: the Agent did not answer (<see cref="AgentAnswers.IsUnanswered"/>): whether it stamped or revoked is not known.</summary>
Unanswered,
}
@@ -21,9 +21,14 @@ public interface IAgentRequests
/// Sends <paramref name="payload"/> as <paramref name="type"/> and returns whatever non-<c>Error</c> envelope
/// answers it — the caller distinguishes the acks (a <c>HookEnabledAck</c> from a <c>Refused</c>).
/// </summary>
/// <exception cref="InvalidOperationException">Not connected.</exception>
/// <exception cref="InvalidOperationException">Not connected: nothing was sent.</exception>
/// <exception cref="Infrastructure.Ipc.IpcRequestException">The Agent answered <c>Error</c>.</exception>
/// <exception cref="TimeoutException">No answer within the request timeout.</exception>
/// <exception cref="TimeoutException">No answer within the request timeout: whether it was carried out is not known.</exception>
/// <exception cref="System.IO.IOException">
/// The connection closed before the Agent answered — it stopped, or restarted for an update (beta.22: every way the pipe
/// closes is this one exception, <see cref="AgentConnection.AnsweredAsync"/>): whether it was carried out is not known.
/// <see cref="AgentAnswers.IsUnanswered"/> names this and the timeout.
/// </exception>
Task<IpcEnvelope> RequestAsync<TRequest>(string type, TRequest payload, CancellationToken ct = default)
where TRequest : class;
}
+4 -1
View File
@@ -15,9 +15,12 @@ public enum PlayOutcome
/// <summary>The capture agent accepted the launch (<c>LaunchGame</c>).</summary>
StartedByAgent,
/// <summary>Direct, and no capture agent is connected.</summary>
/// <summary>Direct, and no capture agent is connected: nothing was sent.</summary>
AgentUnavailable,
/// <summary>beta.22: the agent did not answer (<see cref="AgentAnswers.IsUnanswered"/>): whether the game is starting is not known.</summary>
Unanswered,
/// <summary>Direct, and the entry's recording is off: FrameLedger starts only what it records (schema 0009).</summary>
RecordingOff,
@@ -39,13 +39,10 @@ public sealed class SessionDeletion
return new(SessionDeletionOutcome.AgentUnavailable);
}
IpcEnvelope envelope;
try
{
IpcEnvelope envelope = await _agent.RequestAsync(IpcMessageType.DeleteSessions, new DeleteSessionsRequest(gameId), ct).ConfigureAwait(true);
DeleteSessionsAck ack = IpcCodec.Payload<DeleteSessionsAck>(envelope) ?? throw new InvalidOperationException("DeleteSessions answered without a payload");
Log.Information("sessions: deleted {Sessions} session(s) of {Games} game(s) ({Scope})", ack.Sessions, ack.Games, gameId is null ? "every game" : "game " + gameId);
await ForgetDeletedAsync(ct).ConfigureAwait(true);
return new(SessionDeletionOutcome.Deleted, ack.Games, ack.Sessions);
envelope = await _agent.RequestAsync(IpcMessageType.DeleteSessions, new DeleteSessionsRequest(gameId), ct).ConfigureAwait(true);
}
catch (IpcRequestException ex) when (string.Equals(ex.Code, IpcErrorCode.SessionRunning, StringComparison.Ordinal))
{
@@ -56,14 +53,39 @@ public sealed class SessionDeletion
Log.Warning("sessions: the Agent does not know DeleteSessions ({Message})", ex.Message);
return new(SessionDeletionOutcome.AgentTooOld);
}
catch (Exception ex) when (ex is IpcRequestException or InvalidOperationException or TimeoutException)
catch (IpcRequestException ex)
{
Log.Warning("sessions: DeleteSessions failed ({Message})", ex.Message);
Log.Warning("sessions: DeleteSessions failed ({Code}: {Message})", ex.Code, ex.Message);
return new(SessionDeletionOutcome.Failed, Detail: ex.Message);
}
catch (InvalidOperationException ex)
{
// The connection went between the check above and the request: nothing was sent.
Log.Warning("sessions: DeleteSessions was not sent ({Message})", ex.Message);
return new(SessionDeletionOutcome.AgentUnavailable);
}
catch (Exception ex) when (AgentAnswers.IsUnanswered(ex))
{
// beta.22: the delete may have run before the connection went — it caught no IOException before, and its exception
// was the App's crash dialog. What named a deleted session lets go of it, and the page reads what is stored.
Log.Warning("sessions: DeleteSessions had no answer ({Kind}: {Message})", ex.GetType().Name, ex.Message);
await ForgetDeletedAsync(ct).ConfigureAwait(true);
return new(SessionDeletionOutcome.Unanswered);
}
if (IpcCodec.Payload<DeleteSessionsAck>(envelope) is not { } ack)
{
Log.Warning("sessions: DeleteSessions was answered without a payload");
await ForgetDeletedAsync(ct).ConfigureAwait(true);
return new(SessionDeletionOutcome.Unanswered);
}
Log.Information("sessions: deleted {Sessions} session(s) of {Games} game(s) ({Scope})", ack.Sessions, ack.Games, gameId is null ? "every game" : "game " + gameId);
await ForgetDeletedAsync(ct).ConfigureAwait(true);
return new(SessionDeletionOutcome.Deleted, ack.Games, ack.Sessions);
}
/// <summary>The delete happened: what still names a deleted session lets go of it. A failure here is logged, not the delete's.</summary>
/// <summary>The delete happened, or may have (beta.22): what still names a deleted session lets go of it. A failure here is logged, not the delete's.</summary>
private async Task ForgetDeletedAsync(CancellationToken ct)
{
try
@@ -20,4 +20,10 @@ public enum SessionDeletionOutcome
/// <summary>Anything else; the detail says what.</summary>
Failed,
/// <summary>
/// beta.22: the capture agent did not answer (<see cref="AgentAnswers.IsUnanswered"/>), or answered without saying what it
/// did: whether anything was deleted is not known, and the page reads what is stored.
/// </summary>
Unanswered,
}
@@ -17,6 +17,7 @@ public sealed record SessionDeletionResult(SessionDeletionOutcome Outcome, int G
SessionDeletionOutcome.SessionRunning => Strings.DeleteSessions_Running,
SessionDeletionOutcome.AgentUnavailable => Strings.DeleteSessions_NoAgent,
SessionDeletionOutcome.AgentTooOld => Strings.DeleteSessions_AgentTooOld,
SessionDeletionOutcome.Unanswered => Strings.Agent_Unanswered,
_ => Detail ?? Strings.Common_NotAvailable,
};
}
+3
View File
@@ -70,6 +70,7 @@ public static class Strings
nameof(Agent_State_Offline),
nameof(Agent_State_Starting),
nameof(Agent_State_Viewer),
nameof(Agent_Unanswered),
nameof(App_Title),
nameof(Arch_AnyCpu),
nameof(Arch_AnyCpu32),
@@ -1184,6 +1185,8 @@ public static class Strings
public static string Agent_State_Viewer => ResourceManager.GetString(nameof(Agent_State_Viewer), Culture) ?? nameof(Agent_State_Viewer);
public static string Agent_Unanswered => ResourceManager.GetString(nameof(Agent_Unanswered), Culture) ?? nameof(Agent_Unanswered);
public static string App_Title => ResourceManager.GetString(nameof(App_Title), Culture) ?? nameof(App_Title);
public static string Arch_AnyCpu => ResourceManager.GetString(nameof(Arch_AnyCpu), Culture) ?? nameof(Arch_AnyCpu);
+4
View File
@@ -4317,4 +4317,8 @@
<value>{0} はもうライブラリにないため、起動しませんでした。</value>
<comment>review</comment>
</data>
<data name="Agent_Unanswered" xml:space="preserve">
<value>キャプチャ エージェントが応答しなかったため、この操作が行われたかどうかは分かりません。エージェントが接続してから、もう一度確認してください。</value>
<comment>review</comment>
</data>
</root>
+3
View File
@@ -3248,4 +3248,7 @@ The documents below are the full terms; this summary does not replace them.</val
<data name="Play_NotInLibrary_Format" xml:space="preserve">
<value>{0} is no longer in the library, so it was not started.</value>
</data>
<data name="Agent_Unanswered" xml:space="preserve">
<value>The capture agent did not answer, so whether this was done is not known. Check again once it is connected.</value>
</data>
</root>
+3
View File
@@ -3243,4 +3243,7 @@ Các văn bản bên dưới là điều khoản đầy đủ; bản tóm tắt
<data name="Play_NotInLibrary_Format" xml:space="preserve">
<value>{0} không còn trong thư viện, nên không được chạy.</value>
</data>
<data name="Agent_Unanswered" xml:space="preserve">
<value>Capture agent không trả lời, nên không biết việc này đã được thực hiện hay chưa. Hãy kiểm tra lại khi agent đã kết nối.</value>
</data>
</root>
@@ -910,6 +910,12 @@ public sealed partial class GameDetailViewModel : ObservableObject
if (!result.Succeeded)
{
_strip.Warn(Game.Name, result.Message);
if (result.Outcome == SessionDeletionOutcome.Unanswered)
{
// beta.22: the delete may have run — the page shows what is stored, not what it held before the ask.
await LoadAsync().ConfigureAwait(true);
}
return;
}
@@ -1009,6 +1015,8 @@ public sealed partial class GameDetailViewModel : ObservableObject
HookingConsentOutcome.Refused => (result.RefusalText(), InfoBarSeverity.Error),
HookingConsentOutcome.VersionMismatch => (Shared.Strings.Safety_Consent_VersionMismatch, InfoBarSeverity.Warning),
HookingConsentOutcome.AgentUnavailable => (turningOff ? Strings.Agent_NotConnected_NothingChanged : Shared.Strings.Safety_Consent_AgentUnavailable, InfoBarSeverity.Warning),
// beta.22: the page reads what is stored after every ask, so whether hooking changed is shown beside this.
HookingConsentOutcome.Unanswered => (Strings.Agent_Unanswered, InfoBarSeverity.Warning),
// The Agent could not read the executable (beta.8): say whether its drive or the file is missing, not the IPC code.
HookingConsentOutcome.Failed when string.Equals(result.Detail, Shared.Ipc.IpcErrorCode.ExecutableUnreadable, StringComparison.Ordinal) && Game is not null
=> (Formats.ExecutableMissingText(Game.Fingerprint.ExePath), InfoBarSeverity.Warning),
@@ -736,6 +736,14 @@ public sealed partial class SettingsViewModel : ObservableObject
return;
}
if (result.Outcome == HookingConsentOutcome.Unanswered)
{
// beta.22: whether hooking was turned off is not known — the list is read again from what is stored.
_strip.Warn(game.Name, Strings.Agent_Unanswered);
await RefreshCoreAsync().ConfigureAwait(true);
return;
}
// Turning off with no Agent changed nothing (beta.18): it said the enable path's "Nothing was enabled."
string body = result.Outcome == HookingConsentOutcome.AgentUnavailable ? Strings.Agent_NotConnected_NothingChanged : result.Detail ?? Strings.Common_NotAvailable;
_strip.Warn(game.Name, body);
@@ -316,6 +316,33 @@ public sealed class AgentConnectionTests : IAsyncDisposable
}
/// <summary>beta.10 (the admin mode): a start that asks Windows for administrator rights says so on the pill while it waits.</summary>
/// <summary>
/// beta.22: every way the pipe can close under a request reaches a caller as ONE exception, an IOException. PipeClient fails a
/// request in flight with what ended its reader — an IpcFramingException or an ObjectDisposedException among them — and a
/// caller that knew only IOException ended in the App's crash dialog (beta.21's review of Play). What is not a closed pipe
/// passes through as it was, and an answer is the answer.
/// </summary>
[Fact]
public async Task EveryWayThePipeClosesUnderARequestIsOneIOException()
{
foreach (Exception closed in new Exception[] { new ObjectDisposedException("pipe"), new IpcFramingException("the frame ended early") })
{
Func<Task> request = () => AgentConnection.AnsweredAsync(() => Task.FromException<IpcEnvelope>(closed));
IOException said = (await request.Should().ThrowAsync<IOException>()).Which;
said.InnerException.Should().BeSameAs(closed, closed.GetType().Name);
}
Exception[] kept = [new IOException("the pipe closed before the Agent answered"), new TimeoutException(), new IpcRequestException(IpcErrorCode.SessionRunning, "running")];
foreach (Exception ex in kept)
{
Func<Task> request = () => AgentConnection.AnsweredAsync(() => Task.FromException<IpcEnvelope>(ex));
(await request.Should().ThrowAsync<Exception>()).Which.Should().BeSameAs(ex, ex.GetType().Name);
}
IpcEnvelope answer = IpcCodec.Decode(IpcCodec.Encode(IpcMessageType.DeleteSessionsAck, "1", new DeleteSessionsAck(null, 0, 0)));
(await AgentConnection.AnsweredAsync(() => Task.FromResult(answer))).Should().BeSameAs(answer);
}
[Fact]
public async Task AStartThatAsksForAdministratorRightsSaysSoOnThePill()
{
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
using FluentAssertions;
using FrameLedger.App.Services;
using FrameLedger.App.ViewModels;
@@ -121,6 +122,31 @@ public sealed class AntiCheatExceptionsTests
(await exceptions.GrantAsync(56, _gf2, Ct)).Outcome.Should().Be(AntiCheatExceptionOutcome.VersionMismatch);
}
/// <summary>
/// beta.22: an ask the Agent never answered is not known, and its notice says so in words — it read "IOException"; one the
/// connection was gone before is "no agent", which changed nothing.
/// </summary>
[Fact]
public async Task AnAskTheAgentNeverAnsweredIsNotKnownAndSaidInWords()
{
var agent = new FakeAgent
{
Hello = Hello(AntiCheatExceptionDisclosure.Version),
Answer = static _ => throw new IOException("the connection to the Agent closed before it answered"),
};
var exceptions = new AntiCheatExceptions(agent, new FakePrompt { Accepts = true });
AntiCheatExceptionResult closed = await exceptions.GrantAsync(56, _gf2, Ct);
closed.Outcome.Should().Be(AntiCheatExceptionOutcome.Unanswered);
closed.MessageFor("GIRLS' FRONTLINE 2").Should().Be(Strings.Agent_Unanswered);
agent.Answer = static _ => throw new TimeoutException();
(await exceptions.WithdrawAsync(56, Ct)).Outcome.Should().Be(AntiCheatExceptionOutcome.Unanswered);
agent.Answer = static _ => throw new InvalidOperationException("the Agent is not connected");
(await exceptions.WithdrawAsync(56, Ct)).Outcome.Should().Be(AntiCheatExceptionOutcome.AgentUnavailable, "nothing was sent");
}
[Fact]
public async Task AWithdrawalNeedsNoDialog()
{
+10 -10
View File
@@ -179,26 +179,26 @@ public sealed class GamePlayerTests
}
/// <summary>
/// From the review before the merge: the pipe fails a request in flight with an IOException when the agent stops (PipeClient),
/// and a command's unhandled exception is the App's crash dialog. Each way the connection can go mid-request is "not running".
/// The pipe fails a request in flight when the agent stops, and a command's unhandled exception is the App's crash dialog
/// (beta.21's review). Since beta.22 an answer that never came — the connection closed (one IOException, AgentConnection) or no
/// answer in time — is "not known": the game may be starting. The connection gone before the request is "not running".
/// </summary>
[Fact]
public async Task AConnectionThatGoesMidRequestIsTheAgentNotRunningNeverAnException()
public async Task AnAnswerThatNeverCameIsNotKnownAndARequestNeverSentIsNotRunning()
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
await new RegisteredSettings(new SqliteSettingsStore(s.Db)).SetAsync(SettingsRegistry.UiPlayMode, PlayMode.Direct, Ct);
GameRow game = Game(@"D:\Games\Loose\game.exe", null);
Exception[] gone =
[
new IOException("the pipe closed before the Agent answered"), new ObjectDisposedException("pipe"), new TimeoutException(),
new InvalidOperationException("the Agent is not connected"), new IpcFramingException("truncated frame"),
];
foreach (Exception ex in gone)
foreach (Exception ex in new Exception[] { new IOException("the connection to the Agent closed before it answered"), new TimeoutException() })
{
PlayResult result = await Player(s, new Shell(), new Agent(fails: ex), new Stores()).PlayAsync(game, Ct);
result.Should().Be(new PlayResult(PlayOutcome.AgentUnavailable), ex.GetType().Name);
result.Should().Be(new PlayResult(PlayOutcome.Unanswered), ex.GetType().Name);
GamePlayer.Describe(result, "W").Should().Be((Strings.Agent_Unanswered, true));
}
(await Player(s, new Shell(), new Agent(fails: new InvalidOperationException("the Agent is not connected")), new Stores()).PlayAsync(game, Ct))
.Should().Be(new PlayResult(PlayOutcome.AgentUnavailable), "nothing was sent");
PlayResult refused = await Player(s, new Shell(), new Agent(fails: new IpcRequestException("UnknownType", "no such command")), new Stores())
.PlayAsync(game, Ct);
refused.Should().Be(new PlayResult(PlayOutcome.Failed, Detail: "UnknownType"));
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
using FluentAssertions;
using FrameLedger.App.Services;
using FrameLedger.App.ViewModels;
@@ -148,6 +149,28 @@ public sealed class HookingConsentTests
agent.Sent.Last().Payload.Should().Be(new SetHookEnabledRequest(7, false, null), "a revoke names no disclosure");
}
/// <summary>
/// beta.22: an ask the Agent never answered — the connection closed under it, or no answer in time — is not known, never the
/// exception's type name as the notice (it read "IOException"); one the connection was gone before is "no agent".
/// </summary>
[Fact]
public async Task AnAskTheAgentNeverAnsweredIsNotKnownAndOneNeverSentIsNoAgent()
{
var agent = new FakeAgent { Hello = Hello(SafetyDisclosure.Version) };
var consent = new HookingConsent(agent, new FakePrompt { Accepts = true });
agent.Answer = static _ => throw new IOException("the connection to the Agent closed before it answered");
HookingConsentResult closed = await consent.EnableAsync(7, "Title", Ct);
closed.Outcome.Should().Be(HookingConsentOutcome.Unanswered);
closed.Detail.Should().BeNull("no exception's name is a notice");
agent.Answer = static _ => throw new TimeoutException();
(await consent.DisableAsync(7, Ct)).Outcome.Should().Be(HookingConsentOutcome.Unanswered);
agent.Answer = static _ => throw new InvalidOperationException("the Agent is not connected");
(await consent.DisableAsync(7, Ct)).Outcome.Should().Be(HookingConsentOutcome.AgentUnavailable, "nothing was sent");
}
[Theory]
[InlineData("I ACCEPT THE INJECTION RISK", true)]
[InlineData(" I ACCEPT THE INJECTION RISK ", true)]
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
using FluentAssertions;
using FrameLedger.App.Charts;
using FrameLedger.App.Services;
@@ -221,6 +222,50 @@ public sealed class SessionDeletionAndOverviewTests
windows.Asked.Should().Be(2, "nothing was deleted");
}
/// <summary>
/// beta.22: a delete the Agent never answered — the connection closed under it, or no answer in time — is said as not known;
/// what named a deleted session lets go of it (the delete may have run), and the game page reads what is stored. It caught
/// no IOException before, and that exception was the App's crash dialog. The connection gone before the ask deleted nothing.
/// </summary>
[Fact]
public async Task ADeleteTheAgentNeverAnsweredIsSaidAsNotKnownAndThePageReadsWhatIsStored()
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
GameRow game = await s.GameAsync("Alpha");
long gone = await s.SessionAsync(game.Id, DateTimeOffset.UtcNow.AddHours(-2));
var windows = new Windows();
var selection = new SessionSelection();
selection.Set(gone);
var agent = new ScriptedAgent { Answer = static _ => Task.FromException<IpcEnvelope>(new TimeoutException()) };
var deletion = new SessionDeletion(agent, s.Sessions, selection, windows);
SessionDeletionResult timedOut = await deletion.DeleteAsync(game.Id, Ct);
timedOut.Outcome.Should().Be(SessionDeletionOutcome.Unanswered);
timedOut.Message.Should().Be(Strings.Agent_Unanswered);
windows.Asked.Should().Be(1, "the delete may have run: what named a deleted session lets go of it");
selection.SessionId.Should().Be(gone, "the session is still stored, so it stays selected");
agent.Answer = static _ => throw new InvalidOperationException("the Agent is not connected");
(await deletion.DeleteAsync(game.Id, Ct)).Outcome.Should().Be(SessionDeletionOutcome.AgentUnavailable, "nothing was sent");
windows.Asked.Should().Be(1, "nothing was asked, so nothing can be gone");
// The delete ran and its answer was lost on the way back: the page says it is not known and shows what is stored.
agent.Answer = async r =>
{
await DeletesFrom(s)(r).ConfigureAwait(false);
throw new IOException("the connection to the Agent closed before it answered");
};
var strip = new Strip();
GameDetailViewModel page = await PageAsync(s, game.Id, new Confirm(true), deletion, strip, selection);
page.Sessions.Should().ContainSingle();
await page.DeleteAllSessionsCommand.ExecuteAsync(null);
strip.Lines.Should().Equal("warn:" + Strings.Agent_Unanswered);
page.Sessions.Should().BeEmpty("the page read what is stored after an answer that never came");
selection.SessionId.Should().BeNull("the selected session is gone, and its id can be reused");
}
/// <summary>
/// D39: the overview draws every hooked session's rate and lows; the Trend draws a ticked metric beside the selected
/// one, a second unit on the right, and offers no third unit.