Skip to content

Event streaming (8/11): Add agent evals for event-driven waiting, the gh skill section, and preview docs - #15078

Merged
BagToad merged 4 commits into
babakks/event-hintsfrom
babakks/event-evals
Nov 17, 2026
Merged

BagToad merged 4 commits into
babakks/event-hintsfrom
babakks/event-evals

Conversation

@babakks

@babakks babakks commented Nov 17, 2026

Copy link
Copy Markdown
Member

Layer 8 of 11 in the stack tracked by #15070.

Description

The previous PRs give agents a way to wait for pull request changes instead of polling, plus hints and help to find it. Unit tests cannot tell whether agents actually use it. This PR adds a general agent eval system to measure that kind of behavior, an events suite that measures it for event-driven waiting, and the agent-facing documentation the suite evaluates.

How the eval system works

evals/ is a local, opt-in Vally package for evaluating gh features that agents use. It is independent of the Go build: nothing in go.mod, make, or the Go tests installs or runs it. Vally runs the evals; the package supplies the eval definitions, an executor plugin (gh-agent) that sets up the live GitHub side of each trial, and a grader plugin. evals/run is a thin wrapper that passes the right flags to the pinned vally CLI, and run-evals at the repository root checks the credentials and the gh binary before calling it.

A trial. Each trial gives a Copilot agent a task, an already-built gh, and a fresh private sandbox repository on github.com, then grades what it did:

sequenceDiagram
    participant Vally as evals/run (vally eval)
    participant Exec as gh-agent executor
    participant Suite as Suite
    participant GitHub as GitHub sandbox
    participant Agent as Copilot agent
    participant Second as Second actor
    Vally->>Exec: Start a trial: definition, stimulus, skill on or off
    Exec->>Suite: start()
    Suite->>GitHub: Create the sandbox repository and fixtures, journaled first
    Exec->>Agent: Prompt, isolated home, observed gh
    loop While the agent works
        Agent->>GitHub: gh commands, recorded with their output
        Exec->>Second: Tick on a timer and after each tool call
        Second->>GitHub: Scripted changes
    end
    Exec->>Suite: snapshot()
    Exec->>Exec: Write the evidence file
    Exec->>Suite: Clean up live resources and the sandbox
    Vally->>Vally: Run the graders on the evidence and trajectory
Loading

Suites. Definitions are grouped into suites: families of scenarios that share fixtures, an optional scripted second actor, and graders. The executor is not specific to any suite. A generic core in evals/src/core owns what every live agent trial needs: the isolated home with an observed gh, skill staging, the sandbox and its crash-safe resource journal, the serialized second-actor driver, evidence, and cleanup. A suite plugs in through a small contract in src/core/suite.ts: start provisions a trial and returns its prompt placeholders, an optional actor, and a snapshot of the facts its graders need. evals/README.md walks through adding a suite with a minimal example.

Evidence and grading. A gh launcher records each real gh process's arguments, timing, exit status, and output. At the end of a trial the executor writes an evidence file with every observed command and the suite's snapshot, and graders read that file rather than live GitHub state. Saved runs can be regraded with vally grade, and only model-based graders call a model again.

Skill on and off. evals/run runs each definition once without the gh skill and once with it (--skill off|on|both). The skill is offered through Vally's skill directory, not pasted into the prompt, and the runtime's bundled skills are disabled, so the two configurations differ only by the gh skill. --gh-skill-ref REV:PATH evaluates a skill as committed at a revision, such as trunk:skills/gh, for before and after comparisons.

Isolation and cleanup. Each trial has a fresh home, configuration, workspace, and constructed environment. The agent's token lives in private gh configuration and a Git credential helper, and the second actor's token and the grading evidence are never passed to the agent. This is lightweight isolation, not a security sandbox. Every live resource is journaled before it is created, and cleanup runs after every trial, pass or fail; if it cannot confirm cleanup, it keeps the repository, fails the trial, and prints an evals/cleanup command to retry.

Errors versus failures. A trial errors, rather than fails, when the problem is not the agent's: setup, API, model, observer, or cleanup failures, contamination, or shared state that makes it ungradable. Trials run one at a time and are never retried, because they can share accounts and a second actor assumes it is the only change in flight. Every credential is an explicit environment variable; nothing falls back to the operator's gh login.

The events suite

The events suite checks two things: whether the agent completes the task, and whether it waits through gh event listen rather than polling. Each scenario is an ordinary Vally eval.yml that builds its own live fixture:

Scenario User request Scripted second actor
notify-review Let me know when someone reviews my PR. Submits a review.
pull-after-merge Once this PR is merged, pull the latest main. Merges the PR.
pull-after-close Same request, but the PR closes without merging. Closes the PR without merging.
full-delegation Create a PR, respond to reviews, and merge once approved. Requests a fix, verifies the pushed file, then approves.
review-loop Address successive reviews until approved; do not merge. Requests two distinct fixes on successive heads, then approves the second fix while the agent is working.
listen-at-limit Same as notify-review, but the subscription limit is already full. Submits one comment review.

Prompts never name a waiting command or tell the agent to avoid polling. The second actor makes its change while a recognized gh event listen is running, after letting the agent finish one catch-up read of the pull request; if the agent never starts a listener, the change comes after a third of the agent's budget. review-loop submits its first review before a listener is guaranteed to be attached, so the agent must either listen first or read the pull request after attaching. listen-at-limit fills the subscriber's subscription allowance before the agent starts, probing the limit rather than assuming it.

A trial passes only when all four graders pass:

  • event-task checks the outcome against independently fetched GitHub state, local Git history, and the actor's timeline. A remote merge alone does not satisfy pulling.
  • event-route requires a gh event listen covering each scripted change, with the matching event in its recorded output. Direct gh api, custom SSE clients, and polling do not count.
  • no-polling fails repeated reads of the same pull request state with nothing changed in between. With the skill offered, any polling fails; without it, polling is allowed only before the agent switches to a listener.
  • semantic-review has a separate, tool-free Copilot session review the whole trajectory against the scenario's rubric, ending in a pass or fail verdict. It can fail a trial the mechanical graders passed, but cannot rescue one they failed.

Besides the eval stimuli, each scenario has a design-probe variant, which hints that a waiting capability exists to see which interface agents reach for, and a raw-api variant, which describes the HTTP API for use against a gh without the event command. Two fast checks run before any model trial: evals/replay regrades saved or sanitized evidence offline in under a second, and evals/smoke runs the real two-review protocol and the gh event subscription commands against github.com without a model. Subscriptions are deleted before their sandbox repositories, and only those on the fixture's pull requests.

Agent skill and docs

skills/gh/SKILL.md gains a preview section on waiting for pull request changes with gh event listen: when to use it instead of polling, reading the pull request once the listener is attached, when --follow fits (multi-round review loops only), stopping when a pull request is closed without merging, and freeing a slot at the subscription limit. This is the skill the skill-on trials offer.

.github/skills/running-evals and writing-evals guide agents through running and authoring evals. docs/event-listen-preview.md describes the preview behavior of gh event in one place, linked from docs/README.md.

How did you test this change?

I ran the full matrix with gpt-5.6-luna, one trial per cell and a 300 second agent budget, after first replaying the saved evidence of an earlier run offline (it reproduced that run's verdicts) and passing the live smoke check. All trials cleaned up their sandbox repositories and subscriptions.

Scenario Skill off Skill on
listen-at-limit Fail: polled instead of freeing a slot Pass
notify-review Fail: polled gh pr view with sleep 30, ignoring the hint Pass
pull-after-merge Pass Pass
pull-after-close Pass Pass
full-delegation Pass Fail: no merge before the budget ran out
review-loop Pass Pass

In the skill-on full-delegation failure, the agent used gh event listen --follow and read its output with two 120 second waits. The approval arrived during the first wait, but the agent resumed only after the second and ran out of time before merging. In the previous full run with the same skill content, skill on passed all six scenarios and skill off failed only listen-at-limit.

Key points

  • Local and opt-in. The evals create and delete real repositories and subscriptions, need a preview-enabled user, a sandbox organization, and a second identity, and spend Copilot requests, so they do not run in CI. Every credential is an explicit environment variable; nothing falls back to the operator's gh login.
  • One trial per cell. Results vary between runs; the table is evidence of behavior, not a success rate. The mechanical graders can be rerun offline from saved artifacts.
  • Pull request events only. Other event types are not covered yet.
  • --follow remains a risk. Even with the skill limiting it to review loops, an agent can still pair it with long reads, as the skill-on full-delegation trial shows.
  • The package depends on public npm packages, pinned by evals/package-lock.json.

Notes for reviewers

Stack, bottom to top (this is 8 of 11, based on babakks/event-hints): babakks/event-client, babakks/event-listen, babakks/event-sub-list, babakks/event-sub-create, babakks/event-sub-view, babakks/event-sub-delete, babakks/event-hints, babakks/event-evals, babakks/event-listen-flush, babakks/event-listen-deleted-sub, babakks/event-check-suite.

Start with skills/gh/SKILL.md, the part that ships to users. Then read evals/README.md and evals/suites/events/README.md for the harness and the scenarios, and evals/src/suites/events/grading for how trials are judged. docs/event-listen-preview.md summarizes the behavior of the whole stack.

The preview doc and the events suite guide say that GitHub App installation tokens are admitted when the account the app is installed on is enabled for the preview. That follows the service's access rules; the evals have only been run with a user token.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @babakks will read and reply directly. Name the account.
  • An agent will draft replies and @username will read them before they are posted.
  • Nobody has explicitly committed to replying.

babakks and others added 4 commits November 17, 2026 16:36
Add a preview section on waiting for pull request changes with gh event listen
and managing subscriptions, so agents block on events instead of polling.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: bbce5a7f-103c-4e67-99c9-2d6dc3f6a02b
Add a local harness that runs Copilot agent trials against a supplied gh binary
and skill with Vally, in isolated sandboxes with live GitHub fixtures and a
second actor. A generic core (sandbox, actor driver, observer, session,
evidence, executor, and graders) runs suites behind a Suite contract.

The events suite evaluates whether agents wait for pull request changes with gh
event listen instead of polling, across six scenarios, with deterministic task,
route, and polling graders plus a semantic review. evals/replay re-grades saved
evidence offline, and evals/smoke checks the live protocol without a model.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: bbce5a7f-103c-4e67-99c9-2d6dc3f6a02b
Co-authored-by: Copilot <[email protected]>
Copilot-Session: bbce5a7f-103c-4e67-99c9-2d6dc3f6a02b
Co-authored-by: Copilot <[email protected]>
Copilot-Session: bbce5a7f-103c-4e67-99c9-2d6dc3f6a02b
@babakks
babakks requested a review from a team as a code owner November 17, 2026 17:11
@babakks
babakks requested review from tidy-dev and a balanced review from Copilot and removed request for a team November 17, 2026 17:11
@babakks
babakks added this pull request to stack #15082 November 17, 2026 17:14
@babakks
babakks requested review from BagToad and removed request for tidy-dev November 17, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved defects can conflate GraphQL targets, apply incompatible replay graders, misclassify rejected listener attempts, and use the wrong credentials for cleanup retries.

4 open issues
1 file not reviewed
  • evals/package-lock.json: Generated file
What changed in this PR

Adds the evaluation and documentation layer of the event-streaming stack tracked by #15070. The local, opt-in Vally package measures whether agents complete pull request tasks using event-driven waiting rather than polling, independently of the Go build.

Changes:

  • Adds isolated agent trials, command recording, scripted actors, resource journals, and cleanup.
  • Defines six event scenarios with task, routing, polling, and semantic graders, plus offline replay and live smoke tools.
  • Documents event waiting in the shipped gh skill and adds evaluation runbooks and preview guidance.
File Description
skills/​gh/​SKILL.md Teaches event waiting and subscription management.
run-evals Validates credentials and launches live evaluations.
evals/​tsconfig.json Configures strict TypeScript compilation.
evals/​testdata/​replays/​persistent-review-loop.json Supplies sanitized review-loop replay evidence.
evals/​suites/​events/​review-loop/​eval.yml Defines successive-review evaluation variants.
evals/​suites/​events/​pull-after-merge/​eval.yml Defines merge-then-pull evaluation variants.
evals/​suites/​events/​pull-after-close/​eval.yml Defines close-without-merge evaluation variants.
evals/​suites/​events/​notify-review/​eval.yml Defines review-notification evaluation variants.
evals/​suites/​events/​listen-at-limit/​eval.yml Defines subscription-limit recovery variants.
evals/​suites/​events/​full-delegation/​eval.yml Defines creation-through-merge evaluation variants.
evals/​src/​suites/​index.ts Registers available evaluation suites.
evals/​src/​suites/​events/​suite.ts Connects fixtures, actors, snapshots, and cleanup.
evals/​src/​suites/​events/​smoke-protocol.ts Implements model-free review and subscription checks.
evals/​src/​suites/​events/​scenarios/​review-loop.ts Specifies two review rounds and outcome checks.
evals/​src/​suites/​events/​scenarios/​pull-after-merge.ts Checks local integration after scripted merging.
evals/​src/​suites/​events/​scenarios/​pull-after-close.ts Checks unchanged local state after closing.
evals/​src/​suites/​events/​scenarios/​notify-review.ts Specifies and verifies a submitted review.
evals/​src/​suites/​events/​scenarios/​listen-at-limit.ts Specifies seeded subscription-limit fixtures.
evals/​src/​suites/​events/​scenarios/​full-delegation.ts Checks reviewed fixes and the merged head.
evals/​src/​suites/​events/​scenarios/​definition.ts Defines typed scenario and actor contracts.
evals/​src/​suites/​events/​scenarios.ts Registers event scenarios and prompt placeholders.
evals/​src/​suites/​events/​limit.ts Detects subscription-limit contamination.
evals/​src/​suites/​events/​grading/​task.ts Grades independently recorded task outcomes.
evals/​src/​suites/​events/​grading/​route.ts Grades dedicated event-command observations.
evals/​src/​suites/​events/​grading/​polling.ts Grades repeated status reads.
evals/​src/​suites/​events/​grading/​observations.ts Matches command output to scripted changes.
evals/​src/​suites/​events/​grading/​index.ts Registers deterministic event graders.
evals/​src/​suites/​events/​grading/​evidence.ts Validates and loads versioned replay evidence.
evals/​src/​suites/​events/​grading/​analysis.ts Derives shared routing and polling facts.
evals/​src/​suites/​events/​github.ts Adds subscription API operations and retries.
evals/​src/​suites/​events/​fixtures.ts Provisions and cleans event-specific fixtures.
evals/​src/​suites/​events/​domain.ts Defines event fixtures and evidence schemas.
evals/​src/​suites/​events/​commands.ts Recognizes listeners, readiness, and status reads.
evals/​src/​suites/​events/​actor.ts Performs scripted reviews, merges, and closes.
evals/​src/​smoke.ts Runs the live model-free smoke check.
evals/​src/​smoke.test.ts Covers smoke sequencing and stream collection.
evals/​src/​skills.test.ts Checks skill staging and event guidance.
evals/​src/​review.test.ts Covers semantic-review isolation and cleanup.
evals/​src/​replay.ts Regrades saved evidence without live resources.
evals/​src/​replay.test.ts Covers replay results and regression controls.
evals/​src/​graders/​review.ts Builds and scores semantic-review requests.
evals/​src/​graders/​result.ts Standardizes deterministic grader results.
evals/​src/​graders/​copilot-review.ts Runs isolated, tool-free Copilot reviews.
evals/​src/​grader-plugin.ts Exposes graders through Vally’s plugin interface.
evals/​src/​github.test.ts Covers API retries and subscription pagination.
evals/​src/​executor-plugin.ts Registers the Vally agent executor.
evals/​src/​core/​trial-cleanup.ts Coordinates teardown while retaining failures.
evals/​src/​core/​suite.ts Defines reusable suite and trial interfaces.
evals/​src/​core/​session.ts Hooks actor actions into tool completion.
evals/​src/​core/​sandbox.ts Journals sandbox creation and guarded deletion.
evals/​src/​core/​observer.ts Records real commands and detects contamination.
evals/​src/​core/​io.ts Provides isolated environments and evidence helpers.
evals/​src/​core/​home.ts Prepares agent homes and observed binaries.
evals/​src/​core/​github.ts Provides fixture API access and retry handling.
evals/​src/​core/​executor.ts Orchestrates serialized live agent trials.
evals/​src/​core/​evidence.ts Names the persisted evidence artifact.
evals/​src/​core/​errors.ts Defines non-retryable infrastructure errors.
evals/​src/​core/​calls.ts Defines command evidence and argument parsing.
evals/​src/​core/​actor.ts Serializes actor ticks and evidence writes.
evals/​src/​commands.test.ts Covers command recognition and readiness rules.
evals/​src/​cleanup.ts Retries cleanup and locates unfinished journals.
evals/​src/​cleanup.test.ts Covers teardown failures and shutdown ordering.
evals/​smoke Launches the compiled smoke tool.
evals/​running-evals.md Documents evaluation commands and result interpretation.
evals/​run Maps evaluation options to Vally invocations.
evals/​replay Launches the compiled replay tool.
evals/​package.json Declares evaluation dependencies and package scripts.
evals/​cleanup Launches the compiled cleanup tool.
evals/​.gitignore Excludes dependencies and compiled output.
docs/​README.md Links evaluation and event-preview documentation.
docs/​event-listen-preview.md Summarizes preview commands and lifecycle behavior.
.github/​skills/​writing-evals/​SKILL.md Guides evaluation design and safeguards.
.github/​skills/​writing-evals/​references/​design-notes.md Records grading, timing, and isolation principles.
.github/​skills/​running-evals/​SKILL.md Guides evaluation execution and reporting.
.github/​skills/​running-evals/​references/​execution-modes.md Distinguishes agent-run and caller-run workflows.
.github/​skills/​running-evals/​references/​credentials.md Documents credential roles and authorization checks.

Review effort: Balanced

Comment thread evals/src/replay.ts Resolved
Comment thread evals/src/suites/events/commands.ts Resolved
Comment on lines +60 to +61
const waitCalls = calls.filter(call => dedicatedWait(call));
const waits = waitCalls.map(call => call.startedAt);
Comment thread run-evals Resolved
@BagToad
BagToad merged commit 42d52b4 into trunk Nov 17, 2026
17 checks passed
@BagToad
BagToad deleted the babakks/event-evals branch November 17, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants