Compare commits

...
Author SHA1 Message Date
poli0981andClaude Opus 5.5 2a77be4d83 fix(capture): launch mode's refused outcome carries the launcher's pid, so the descendant election finally runs (beta.15 PR-2)
From the beta.14 audit (chip, folded into beta.15 by the owner). CaptureSession built the outcome of launch mode's two
guard refusals (LaunchTargetExited, LaunchNoPresentationRuntime) without TargetPid, and
CaptureOrchestrator.ElectAfterLaunchAsync returned at `TargetPid == 0` - before its own "election:" log line - so the
election (#150, 2026-09-10) never ran. The orchestrator's tests built the outcome by hand with the pid, which is why
nothing saw it.

- The refused cue is `refused with { TargetPid = pid, ExitCode = alive.ExitCode }`; the refusal handling moved to
  CaptureSession.RefusedAsync (MA0051 - SessionAsync was at 60 lines).
- ElectAfterLaunchAsync logs an outcome without a launcher pid instead of returning silently.
- CaptureSessionLaunchTests.TheGuardsTwoLaunchRefusalsAreTheirOwnSessionEndReasons asserts the pid (red before: 0).

Reachable from `Agent --console launch` (the App sends no LaunchGame). A real launcher run is still owed (owner-only).
Docs: 04_CAPTURE (corrected in place), spike-notes §14.2, CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 07:26:29 +07:00
6 changed files with 52 additions and 18 deletions

No files matched your search

+4
View File
@@ -30,6 +30,10 @@ numeric core and does not move; the heading is the full version — corrected 20
### Fixed
- **A game started through its launcher was never followed to the game itself** (the Agent's `--console launch`): when
the launcher exited or never drew a frame, FrameLedger was to find the game the launcher had started and record it, and
it never did — the launcher's process id was not passed on, so the search stopped before it began. It is passed on now,
and a launch that ends without one says so in the log.
- **After a change of language some text stayed in the old one** until FrameLedger restarted: the theme and update-channel
lists in Settings, the log and level lists on the Logs page, the sort order on the Games page, the tray icon's menu and
the Agent's status in the title bar. They follow the language at once now.
+5
View File
@@ -208,6 +208,11 @@ which makes the notification more important than it was, not less.
> that spawns the real game and quits lands on the first, and re-electing the descendant is the Agent's
> (P2, §Process watcher) — **built 2026-09-10 (PR-F)**: the Agent's `--console launch` hands either
> answer to `DescendantElection` and runs an attach-mode session against the newest tracked descendant.
> *(Corrected 2026-10-06, beta.15: **it never ran until beta.15.** The refused outcome carried no `TargetPid`, and
> `CaptureOrchestrator.ElectAfterLaunchAsync` returned at `TargetPid == 0` — before its own `election:` log line — on every
> launch since #150; the orchestrator's tests built the outcome by hand, pid included, so nothing saw it. The refused
> outcome carries the launcher's pid and exit code now (`CaptureSessionLaunchTests` pins it), and an outcome without
> one is logged rather than silent. A real launcher run is still owed: HANDOFF, owner-only.)*
> **The host never terminates what it launched**: any refusal after the start
> leaves the title running unhooked, which is Tier 2.
>
+3
View File
@@ -2531,6 +2531,9 @@ then elects the newest tracked descendant and attaches.
spawns — so the run is: `consent grant` the launcher, `launch` it, read the `election:` line, then
`consent grant` the game the election named and `launch` again.
*(2026-10-06, beta.15: before beta.15 the `election:` line could not appear — the launch's refused outcome carried no
launcher pid and the election returned before it logged anything. Run this table on beta.15 or later.)*
| | |
|---|---|
| Title / launcher | |
@@ -288,6 +288,32 @@ public sealed class CaptureSession(
return observed is null ? SessionEndReason.ExecutableUnreadable : null;
}
/// <summary>The guard refused (and the target is not Vulkan-layered): the outcome, held as Tier 2 unless it is launch mode's cue.</summary>
private async Task<CaptureOutcome> RefusedAsync(AntiCheatVerdict verdict, HookRequest request, ExecutableFingerprint observed,
ITargetLiveness alive, int pid, TimeSpan? launchWait, CancellationToken ct, CancellationToken stop)
{
// A finding about the game turns its hooking off here and now (owner decision 2026-09-22), not only at
// the pre-scan: the guard's start-time scan sees the process and the drivers the pre-scan cannot.
bool turnedOff = await TurnHookingOffAsync(observed, verdict, ct).ConfigureAwait(false);
var refused = new CaptureOutcome
{
Reason = RefusalOf(verdict.Reason),
Verdict = verdict,
LaunchWait = launchWait,
HookingTurnedOff = turnedOff,
ExceptionFamily = request.ToleratedFamily,
};
// Launch mode's two guard refusals are the orchestrator's cue to elect a descendant (04_CAPTURE §Launch
// mode); holding the launcher's session open would delay that. Every other refusal is Tier 2 from here.
// The launcher's pid goes with the cue (beta.15): the election looks for the launcher's descendants BY it, and
// an outcome without it made ElectAfterLaunchAsync return before electing anything — since the election was
// written (#150). Its exit code too, as every other ending records one.
return refused.Reason is SessionEndReason.LaunchTargetExited or SessionEndReason.LaunchNoPresentationRuntime
? refused with { TargetPid = pid, ExitCode = alive.ExitCode }
: await HoldUnhookedAsync(refused, observed.ExePath, alive, pid, ct, stop).ConfigureAwait(false);
}
/// <summary>Gate, attach, drain — shared by both modes; <paramref name="started"/> non-null is launch mode.</summary>
private async Task<CaptureOutcome> SessionAsync(int pid, ITargetLiveness alive, GameConsentRecord record,
ExecutableFingerprint observed, string payloadPath, Stopwatch? started, CancellationToken ct, CancellationToken stop)
@@ -312,23 +338,8 @@ public sealed class CaptureSession(
bool layered = verdict.Reason == AntiCheatRefusalReason.TargetIsVulkanLayered;
if (!verdict.IsAllowed && !layered)
{
// A finding about the game turns its hooking off here and now (owner decision 2026-09-22), not only at
// the pre-scan: the guard's start-time scan sees the process and the drivers the pre-scan cannot.
bool turnedOff = await TurnHookingOffAsync(observed, verdict, ct).ConfigureAwait(false);
var refused = new CaptureOutcome
{
Reason = RefusalOf(verdict.Reason),
Verdict = verdict,
LaunchWait = launchWait,
HookingTurnedOff = turnedOff,
ExceptionFamily = request.ToleratedFamily,
};
channel?.Dispose();
// Launch mode's two guard refusals are the orchestrator's cue to elect a descendant (04_CAPTURE §Launch
// mode); holding the launcher's session open would delay that. Every other refusal is Tier 2 from here.
return refused.Reason is SessionEndReason.LaunchTargetExited or SessionEndReason.LaunchNoPresentationRuntime
? refused
: await HoldUnhookedAsync(refused, observedPath, alive, pid, ct, stop).ConfigureAwait(false);
return await RefusedAsync(verdict, request, observed, alive, pid, launchWait, ct, stop).ConfigureAwait(false);
}
TimeSpan attachBudget = layered ? options.LaunchWaitBudget : options.AttachBudget;
@@ -287,12 +287,19 @@ public sealed class CaptureOrchestrator
public async Task<RecordedSession?> ElectAfterLaunchAsync(RecordedSession launched, CancellationToken ct)
{
ArgumentNullException.ThrowIfNull(launched);
if (launched.Outcome.Reason is not (SessionEndReason.LaunchTargetExited or SessionEndReason.LaunchNoPresentationRuntime)
|| launched.Outcome.TargetPid == 0)
if (launched.Outcome.Reason is not (SessionEndReason.LaunchTargetExited or SessionEndReason.LaunchNoPresentationRuntime))
{
return null;
}
// Never silent again (beta.15): an outcome without the launcher's pid returned here without a word, and the operator's
// guide (spike-notes §14.2) told them to read an `election:` line that could not appear.
if (launched.Outcome.TargetPid == 0)
{
_log("election: the launch ended without the launcher's pid; nothing to elect from");
return null;
}
IReadOnlyList<GameRow> watchlist = Recorded(await _games.ListAsync(ct).ConfigureAwait(false));
HashSet<string> tracked = new(watchlist.Select(static g => g.Fingerprint.ExePath), StringComparer.OrdinalIgnoreCase);
ProcessSnapshot? elected = DescendantElection.Elect(_processes.Take(), launched.Outcome.TargetPid, tracked.Contains);
@@ -234,6 +234,10 @@ public sealed class CaptureSessionLaunchTests : IAsyncDisposable
r.Reason.Should().Be(expected);
r.Verdict.Reason.Should().Be(native);
// beta.15: the launcher's pid is the election's input (CaptureOrchestrator.ElectAfterLaunchAsync). Without it the
// election returned before it ran, every time since it was written.
r.TargetPid.Should().Be(_pid, "the orchestrator elects among the launcher's descendants by this pid");
}
}