From 3c62a128bb404c183a5162d072f7cbd630c4ddcd Mon Sep 17 00:00:00 2001 From: Anton Sememenko Date: Tue, 27 Jan 2026 17:41:39 +0200 Subject: [PATCH 1/5] add PoR intercept primitive (abstention) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ┌────────────────────────────┐ │ copilot-por-sdk (fork) │ │ │ │ Copilot internals │ │ ├─ request planning │ │ ├─ tool resolution │ │ └─ output emission │ │ │ │ │ ▼ │ │ por-copilot-bridge │ ← OPEN SOURCE │ (interception layer) │ │ │ │ │ ▼ │ │ PoR Kernel API │ ← PRIVATE / PAID │ (black box control) │ └────────────────────────────┘ --- nodejs/src/por/intercept.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 nodejs/src/por/intercept.ts diff --git a/nodejs/src/por/intercept.ts b/nodejs/src/por/intercept.ts new file mode 100644 index 00000000..9ecf7a7f --- /dev/null +++ b/nodejs/src/por/intercept.ts @@ -0,0 +1,17 @@ +export type PorDecision = "PROCEED" | "ABSTAIN"; + +export function porCheck(args: { + coherence: number; + drift: number; + thresholds?: { coherence: number; drift: number }; +}): { decision: PorDecision; reason?: string } { + const thresholds = args.thresholds ?? { coherence: 0.72, drift: 0.18 }; + + if (args.drift > thresholds.drift) { + return { decision: "ABSTAIN", reason: "drift_gt_tolerance" }; + } + if (args.coherence < thresholds.coherence) { + return { decision: "ABSTAIN", reason: "coherence_lt_threshold" }; + } + return { decision: "PROCEED" }; +} From db80828598b7e84291bda06a0465a660e411e1d9 Mon Sep 17 00:00:00 2001 From: Anton Sememenko Date: Tue, 27 Jan 2026 17:45:59 +0200 Subject: [PATCH 2/5] describe PoR interception layer runner loop execute agent conversation retry plan --- nodejs/src/por/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 nodejs/src/por/README.md diff --git a/nodejs/src/por/README.md b/nodejs/src/por/README.md new file mode 100644 index 00000000..d20ea001 --- /dev/null +++ b/nodejs/src/por/README.md @@ -0,0 +1,8 @@ +# copilot-por-sdk + +Fork of github/copilot-sdk with an interception layer for control primitives. + +PoR primitive: when coherence cannot be guaranteed, the agent may intentionally abstain +instead of retrying indefinitely. + +Status: WIP (por-interception-layer). From 627381ee0352cba9f63acd81cd4ec4bf5467f41b Mon Sep 17 00:00:00 2001 From: Anton Sememenko Date: Tue, 27 Jan 2026 17:59:23 +0200 Subject: [PATCH 3/5] Add PoR AutoResonance Certification workflow This workflow automates the certification process for PoR AutoResonance, including setup, dependency installation, and certificate generation. --- scripts/CERTIFICATE.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 scripts/CERTIFICATE.md diff --git a/scripts/CERTIFICATE.md b/scripts/CERTIFICATE.md new file mode 100644 index 00000000..10b149e8 --- /dev/null +++ b/scripts/CERTIFICATE.md @@ -0,0 +1,42 @@ +name: PoR AutoResonance Certification + +on: + push: + branches: [main] + pull_request: + +jobs: + por-certify: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm ci + + - name: Run PoR invariant certification + run: | + node scripts/por_certify.js + + - name: Generate certificate + if: success() + run: | + echo "# PoR AutoResonance Certificate" > CERTIFICATE.md + echo "" >> CERTIFICATE.md + echo "Commit: $GITHUB_SHA" >> CERTIFICATE.md + echo "Date: $(date -u)" >> CERTIFICATE.md + echo "Status: CERTIFIED" >> CERTIFICATE.md + + - name: Upload certificate artifact + if: success() + uses: actions/upload-artifact@v4 + with: + name: por-autoresonance-certificate + path: CERTIFICATE.md From 4d3a830296f489fe0ad6af8ab8b4269bc472e021 Mon Sep 17 00:00:00 2001 From: Anton Sememenko Date: Tue, 27 Jan 2026 21:17:40 +0200 Subject: [PATCH 4/5] Handle abstention outcomes in test helper --- dotnet/test/Harness/SessionOutcome.cs | 20 +++++++++++++++++++ dotnet/test/Harness/TestHelper.cs | 28 ++++++++++++++++++--------- 2 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 dotnet/test/Harness/SessionOutcome.cs diff --git a/dotnet/test/Harness/SessionOutcome.cs b/dotnet/test/Harness/SessionOutcome.cs new file mode 100644 index 00000000..78603242 --- /dev/null +++ b/dotnet/test/Harness/SessionOutcome.cs @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +namespace GitHub.Copilot.SDK.Test.Harness; + +public enum SessionOutcomeKind +{ + Message, + Abstention, +} + +public sealed record SessionOutcome(SessionOutcomeKind Kind, AssistantMessageEvent? AssistantMessage) +{ + public static SessionOutcome Message(AssistantMessageEvent message) => + new(SessionOutcomeKind.Message, message); + + public static SessionOutcome Abstention() => + new(SessionOutcomeKind.Abstention, null); +} diff --git a/dotnet/test/Harness/TestHelper.cs b/dotnet/test/Harness/TestHelper.cs index 6dd919bc..05f422f2 100644 --- a/dotnet/test/Harness/TestHelper.cs +++ b/dotnet/test/Harness/TestHelper.cs @@ -6,11 +6,11 @@ namespace GitHub.Copilot.SDK.Test.Harness; public static class TestHelper { - public static async Task GetFinalAssistantMessageAsync( + public static async Task GetFinalSessionOutcomeAsync( CopilotSession session, TimeSpan? timeout = null) { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); using var cts = new CancellationTokenSource(timeout ?? TimeSpan.FromSeconds(60)); AssistantMessageEvent? finalAssistantMessage = null; @@ -22,8 +22,10 @@ public static class TestHelper case AssistantMessageEvent msg: finalAssistantMessage = msg; break; - case SessionIdleEvent when finalAssistantMessage != null: - tcs.TrySetResult(finalAssistantMessage); + case SessionIdleEvent: + tcs.TrySetResult(finalAssistantMessage != null + ? SessionOutcome.Message(finalAssistantMessage) + : SessionOutcome.Abstention()); break; case SessionErrorEvent error: tcs.TrySetException(new Exception(error.Data.Message ?? "session error")); @@ -34,7 +36,7 @@ public static class TestHelper // Check existing messages CheckExistingMessages(); - cts.Token.Register(() => tcs.TrySetException(new TimeoutException("Timeout waiting for assistant message"))); + cts.Token.Register(() => tcs.TrySetException(new TimeoutException("Timeout waiting for session outcome"))); return await tcs.Task; @@ -42,7 +44,7 @@ async void CheckExistingMessages() { try { - var existing = await GetExistingFinalResponseAsync(session); + var existing = await GetExistingFinalOutcomeAsync(session); if (existing != null) tcs.TrySetResult(existing); } catch (Exception ex) @@ -52,7 +54,15 @@ async void CheckExistingMessages() } } - private static async Task GetExistingFinalResponseAsync(CopilotSession session) + public static async Task GetFinalAssistantMessageAsync( + CopilotSession session, + TimeSpan? timeout = null) + { + var outcome = await GetFinalSessionOutcomeAsync(session, timeout); + return outcome.AssistantMessage; + } + + private static async Task GetExistingFinalOutcomeAsync(CopilotSession session) { var messages = (await session.GetMessagesAsync()).ToList(); @@ -68,10 +78,10 @@ async void CheckExistingMessages() for (var i = idleIdx - 1; i >= 0; i--) { if (currentTurn[i] is AssistantMessageEvent msg) - return msg; + return SessionOutcome.Message(msg); } - return null; + return SessionOutcome.Abstention(); } public static async Task GetNextEventOfTypeAsync( From 1927411e7d7fc88475887db82a081b91ad969719 Mon Sep 17 00:00:00 2001 From: Anton Sememenko Date: Thu, 29 Jan 2026 11:58:00 +0200 Subject: [PATCH 5/5] Improve auto resonance workflow structure --- .github/workflows/auto_resonance.yml | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/auto_resonance.yml diff --git a/.github/workflows/auto_resonance.yml b/.github/workflows/auto_resonance.yml new file mode 100644 index 00000000..ae49a0b5 --- /dev/null +++ b/.github/workflows/auto_resonance.yml @@ -0,0 +1,41 @@ +name: "Auto Resonance" + +on: [push, pull_request] + +permissions: + contents: read + id-token: write + attestations: write + +jobs: + auto-resonance: + name: "Auto Resonance" + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Run Proof-of-Resonance Core + run: | + echo "Run Proof-of-Resonance Core" + + - name: Run Resonant Stability Field + run: | + echo "Run Resonant Stability Field" + + - name: Generate Build Provenance + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: actions/attest-build-provenance@v1 + with: + subject-path: . + + - name: Upload Resonance Artifacts + uses: actions/upload-artifact@v4 + with: + name: resonance-artifacts + path: | + artifacts/** + if-no-files-found: warn