Skip to content

feat(verify-tck): run acp-tck against a conformance agent in CI - #163

Merged
ThomasK33 merged 6 commits into
acp-tck/init-gatefrom
acp-tck/verify-tck
Nov 24, 2026
Merged

ThomasK33 merged 6 commits into
acp-tck/init-gatefrom
acp-tck/verify-tck

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Why

The SDK had no check against the spec's own requirements, only against real peers (G3 to G5). acp-tck is the ACP Test Compatibility Kit. It drives an agent over stdio and reports 134 v1 requirements, each with a spec citation. This PR runs it on every PR, the way the Kotlin SDK does. Stacked on #162.

What changed

  • .agents/skills/verify-tck/, its own module:
    • a conformance agent that advertises every capability a v1 requirement checks;
    • a uv runner pinned to acp-tck v0.5.0 (7c71c4d);
    • baseline.json, with a reason for every requirement that does not pass;
    • tckcheck, which reports any drift: a status or tier change, a missing ID, NOT_TESTED, a TCK version change, or a verdict change;
    • run.sh, which builds the agent with -race and fails on any data race;
    • SKILL.md.
  • make tck and make tck-update. make test runs the agent's and tckcheck's offline tests.
  • A tck job in ci.yaml that runs make tck and uploads the report as the tck-report artifact. It has contents: read and a 20-minute timeout.

Scope

The v1 suite, agent side only. The TCK has no client or proxy suite. Its v2 suite (296 requirements) waits for a v2 package.

Tradeoffs

Blast Radius

CI time, plus a new job. It is not a required check.

Verification

  • At schema 1.34.1 the run is CONFORMANT: 39/39 MANDATORY and 53/53 CAPABILITY pass, and 33 ADVISORY pass with 4 skipped. That is 41 more CAPABILITY passes than example/agent gets.
  • 0 drifted on every run. Sensitivity checks:
    • Breaking notFound in the agent, or deleting the ready wait in the SDK, makes run.sh exit 1 and name the failure.
    • tckcheck's tests failed against a stub first.
  • run.sh passes on bash 3.2 and bash 5.
  • make test, actionlint, zizmor and treefmt (mdsh not installed) are clean.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Adds the verify-tck skill: a conformance agent built on the SDK that advertises every capability a v1 requirement of acp-tck v0.5.0 checks, a uv runner pinned to that TCK commit, baseline.json with a reason for every requirement that does not pass, tckcheck to compare a run with it, and run.sh, which builds the agent with -race and fails on any data race. make tck runs it and make tck-update rewrites the baseline; make test runs the agent's and tckcheck's offline tests.

At schema 1.34.1 the agent is CONFORMANT: all 39 MANDATORY and all 53 CAPABILITY requirements pass, and the 4 ADVISORY skips are recorded with their reasons.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
A tck job beside check runs make tck, uploads the TCK report as the tck-report artifact even when it fails, and fails when a result drifts from the baseline. It reads the repo only and stops after 20 minutes.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33
ThomasK33 added this pull request to stack #164 November 23, 2026 15:10
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T15:51:50.122538Z 7ec30d6 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3546ed51ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// open applies st to s and opens it. The caller checked st and holds a.mu.
// It returns the MCP servers to start once a.mu is released.
func (a *agent) open(s *session, st setup) []acp.McpServer {
s.cwd = st.cwd

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject attempts to relocate an existing session

When a session created under one cwd is later loaded or resumed with another absolute cwd, this assignment silently relocates it. The generated LoadSessionRequest and ResumeSessionRequest contracts require the request cwd to match the session's stored cwd; accepting the mismatch also makes subsequent listing and MCP processes use the wrong workspace. Validate existing-session requests and return an invalid-params error instead of overwriting the stored directory.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 7ec30d6: load and resume now reject a cwd other than the session's with -32602 (reopenable).

Comment on lines +291 to +293
if st.dirs != nil {
s.dirs = st.dirs
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear omitted additional directories during reopen

When session/load or session/resume omits additionalDirectories (or sends an empty list, which decodes to nil), this conditional retains the session's previous directories. Those request contracts specify that omitted or empty means no additional roots and that a non-empty value is the complete resulting list, so the agent continues exposing stale filesystem roots and reports them from session/list. Assign the requested list unconditionally when reopening the session.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 7ec30d6: reopening assigns the requested additionalDirectories as the whole list, so omitting it clears it. TestAgent_ReopenReplacesAdditionalDirectories covers it.

Comment on lines +371 to +372
a.mu.Lock()
servers := a.open(s, st)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Revalidate the session after replaying load history

If session/delete runs while LoadSession is replaying history, deletion can remove the session after the lookup at line 359, but this code then reopens the stale pointer without checking the map again. The load returns success for a session that is neither listed nor addressable, and startMCP can attach processes that shutdown will never stop because the session was removed from a.sessions. Revalidate or reserve the session when committing the load after replay.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 7ec30d6: after the replay, LoadSession looks the session up again and answers -32002 if a delete removed it, without reopening it or starting MCP servers.

run = append(run, drift{Expected: "a run that negotiated the protocol version", Got: "blocked_by_version_mismatch"})
}

want := updated(b, r)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject stale flaky exemptions in the baseline

When flaky contains a misspelled ID or an ID removed from the pinned TCK, updated drops it from want.Flaky, but check never compares that list with b.Flaky, so make tck exits successfully even though make tck-update would rewrite the baseline. This leaves an unreviewed stale exemption in the supposedly canonical baseline; report a drift whenever the flaky lists differ.

AGENTS.md reference: AGENTS.md:L12-L12

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 7ec30d6: a flaky id that the report does not have is now a drift. A new TestCheck_Drift case covers it.

Comment on lines +483 to +485
func (a *agent) ListSessions(ctx context.Context, p acp.ListSessionsRequest) (acp.ListSessionsResponse, error) {
if p.Cursor != nil {
return acp.ListSessionsResponse{}, invalid("unknown cursor: the agent never issues one", "cursor", *p.Cursor)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject relative cwd filters in session/list

When a client supplies a relative p.Cwd, this method treats it as an ordinary filter and returns a successful empty list. ListSessionsRequest.Cwd explicitly requires an absolute path, and its generated Validate method does not enforce that semantic constraint, so the agent must reject this input with invalid params rather than silently accepting a malformed request.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 7ec30d6: a relative cwd filter in session/list gets -32602.

Comment on lines +399 to +402
func (a *agent) UnstableSessionOptions(ctx context.Context, p acp.UnstableSessionOptionsRequest) (acp.UnstableSessionOptionsResponse, error) {
a.mu.Lock()
defer a.mu.Unlock()
s := &session{mode: modeAsk, model: modelFast}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate workspace paths passed to session/options

For session/options without a sessionId, a relative cwd or relative additionalDirectories entry still receives a normal options response because this implementation never examines either field. Both fields are specified as absolute paths, while generated validation only checks that cwd is non-empty, so the advertised options capability accepts invalid requests and can produce false-positive conformance results. Apply the same path validation used by session setup before returning the snapshot.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 7ec30d6: session/options runs the same absolute-path checks on cwd and additionalDirectories as session setup.

…kipped

session/load and session/resume reject a cwd other than the session's, and take additionalDirectories as the whole list, so omitting it clears it. A load revalidates the session after its replay, so a delete during the replay answers -32002 instead of reopening a removed session. session/list and session/options reject relative paths. tckcheck reports a flaky id that the report no longer has.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ec30d64ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +429 to +432
if p.SessionId != nil {
var err error
if s, err = a.lookup(*p.SessionId, false); err != nil {
return acp.UnstableSessionOptionsResponse{}, err

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply load/resume cwd rules to session/options

When sessionId names an existing session and p.Cwd is a different absolute path, this branch only verifies that the session exists and returns its options successfully. The request contract requires the same cwd rules as session/load and session/resume, which now reject this mismatch with -32602; the newly added absolute-path check therefore does not cover this distinct identity mismatch. Apply reopenable (or an equivalent stored-cwd comparison) before returning the options.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 0855c9a: with a sessionId, session/options now applies the cwd rule of load and resume, so another cwd gets -32602.

Comment on lines +322 to +324
func (a *agent) NewSession(ctx context.Context, p acp.NewSessionRequest) (acp.NewSessionResponse, error) {
st := setup{p.Cwd, p.AdditionalDirectories, p.SystemPrompt, p.McpServers, p.ConfigOptions}
if err := st.check(); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require reauthentication after logout

After Logout sets authenticated to false, NewSession never consults that state, so a client can successfully create another session immediately after logging out. The logout contract states that all new sessions must require authentication after a successful logout; as written, this agent can even report unauthenticated from auth/status while continuing to create sessions, leaving the conformance gate unable to exercise the advertised logout behavior correctly. Track the logged-out state and return auth_required (-32000) until Authenticate succeeds again.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 0855c9a: after a logout, session/new and session/fork get -32000 until the next authenticate. TestAgent_LogoutRequiresAuthentication covers it.

d.Expected, d.Got = "tier "+e.Tier, q.Tier
case e.Status != q.Status && !slices.Contains(b.Flaky, q.ID):
d.Expected, d.Got, d.Detail = e.Status, q.Status, firstFailure(q)
case reason != "" && e.Reason == "":

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject stale reasons on passing requirements

If a baseline entry has status PASS but retains an old reason—for example, after someone manually updates the status for an improvement—updated removes that reason, yet this switch only detects the opposite case where a reason is required but absent. Consequently make tck exits successfully even though make tck-update rewrites the baseline, and the checked-in baseline can misleadingly claim that a passing requirement still has an SDK gap. Treat a reason that updated would remove as baseline drift.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 0855c9a: a passing requirement that keeps a reason is now a drift (expected no reason, got a reason for a PASS requirement).

Comment on lines +151 to +152
if b.Conformant != r.Verdict.Conformant {
run = append(run, drift{Expected: conformance(b.Conformant), Got: conformance(r.Verdict.Conformant)})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor flaky exemptions when comparing the verdict

When a MANDATORY or CAPABILITY requirement listed in flaky changes between passing and failing, the per-requirement comparison correctly accepts the status change, but that change also flips the report's conformant verdict and this unconditional comparison still reports drift. The documented flaky exemption therefore cannot prevent intermittent CI failures for tiers that affect conformance. Suppress a verdict change when it is fully explained by exempted requirement statuses, or derive the comparison from the non-flaky results.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 0855c9a: a verdict change is not reported when a flaky requirement changed status. Status changes of non-flaky requirements still drift on their own lines.

Comment thread .agents/skills/verify-tck/agent/mcp.go Outdated
Comment on lines +101 to +104
func (s *session) stopMCP() {
for _, stdin := range s.mcp {
_ = stdin.Close()
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Terminate MCP subprocesses when closing a session

When a stdio MCP server does not exit on EOF—for example, it is hung or does not read stdin—closing only its input pipe leaves the subprocess and the goroutine blocked in cmd.Wait alive. Because the session stores no process handle, session/close, delete, archive, and agent shutdown cannot satisfy their resource-cleanup guarantees, and a deleted session can orphan the process permanently. Retain the command/process and perform a bounded graceful shutdown followed by termination and waiting.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 0855c9a: each stdio server keeps its process. Stopping one closes its stdin and kills it if it has not exited after 2 s (mcpStopGrace), and shutdown waits for them. TestMCPServer_StopKillsAServerThatIgnoresEOF covers a server that ignores EOF.

…hang

After a logout, session/new and session/fork get -32000 until the next authenticate, as the logout contract asks. session/options for an existing session applies the cwd rule of load and resume. Stopping a stdio MCP server closes its stdin and kills it if it has not exited after 2 s, and shutdown waits for the servers. tckcheck reports a reason left on a passing requirement, and accepts a verdict change caused by a flaky requirement.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

Pre-merge verification of 0855c9a: PASS+NOTES

I ran it in a detached worktree of 0855c9a, against #162 at 23fb821:

  • make tck twice: 0 drifted, no race in either run (206 s, 205 s). Both runs are CONFORMANT: 39/39 MANDATORY, 53/53 CAPABILITY, 33 ADVISORY passing, 4 skipped, 5 INFORMATIONAL.
  • Sensitivity: when notFound returns -32602, run.sh drifts ACP-ERROR-003/004 and TestAgent_UnknownAndClosedSessions fails. Without <-a.ready (extensions.go:38), run.sh reports a race in 8 agent processes (handleBeforeInitialize vs agent.go:56). Disabling the stale flaky id, stale PASS reason or flaky verdict rule fails its own TestCheck_Drift subtest.
  • make test passes, and so does go test -race -count=3 ./... in verify-tck. treefmt (gofmt, mdformat, actionlint, zizmor), gofumpt, actionlint and zizmor on ci.yaml are clean.
  • CI on the head: check and tck are green. tckcheck on the run's tck-report artifact against this baseline.json: 134 requirements, 0 drifted.
  • Landing: git diff 23fb821 0855c9a touches only .agents/skills/verify-tck, ci.yaml, Makefile and AGENTS.md. --remerge-diff of both merge commits is empty.
  • Every baseline reason matches its skip message in acp-tck v0.5.0. Spot checks of SKILL.md and the AGENTS.md lines against the code, ci.yaml and the TCK source (prompt texts, 296 v2 requirements) found no mismatch apart from note 1.

Notes (none blocks the merge):

  1. ACP-SYSPROMPT-002 and -003 are PASS, but 2 of each row's 3 tests skip: the load and resume tests need the session in a fresh process (test_session_capabilities.py:958). tckcheck reads only a row's status, so nothing tests that load and resume reject a bad systemPrompt (agent.go:385, :423): neither the TCK nor agent_test.go. SKILL.md:120 says "the rows that load a session in a second process skip". No row skips for that reason; those tests skip inside PASS rows. The one row that skips for lack of persistence, ACP-OPTIONS-009, sends session/options, not a load.
  2. startMCP (mcp.go:22-43) starts and attaches servers after load or resume has released a.mu (agent.go:417, :438). It does not check again that the session is still stored and open. A scratch probe raced resume (with a sleep 30 stdio server) against close or delete. 69/200 closes left the server running on a closed session. 33/200 deletes left it on a deleted session, where shutdown() never stops it. This is the same class of bug as the replay window that 7ec30d6 fixed. No TCK row does this.
  3. No test covers the post-replay check in LoadSession (agent.go:404-413): with it disabled, go test ./agent still passes.
  4. If flakyChanged returns true whenever any flaky id is listed, main_test.go still passes. The exit code is the same today, because every non-flaky status change drifts on its own line.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

@ThomasK33
ThomasK33 added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 0511213 Nov 24, 2026
6 checks passed
@ThomasK33
ThomasK33 deleted the acp-tck/verify-tck branch November 24, 2026 13:06
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.

2 participants