Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This repo is a CortexKit-maintained Anthropic auth monorepo for OpenCode and Pi. The OpenCode package is a fork of the original `@ex-machina/opencode-anthropic-auth` plugin, so older entries below the initial CortexKit release are inherited from upstream package history.

## Unreleased

- Requests no longer wait on relay or session-pin bookkeeping locks; relay settings and tokens are checked together before sending.

## 2.1.1

### Packaging
Expand Down
52 changes: 52 additions & 0 deletions mutations.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1354,3 +1354,55 @@ expect_message = "error: expect(received).toEqual(expected)"
broad_command = ["bun", "scripts/run-mutation-bun.ts", "--broad", "packages/core", "tmp/mutations/core.xml"]
broad_report = "tmp/mutations/core.xml"
broad_id = "{name}"

[[control]]
id = "native-relay-read-never-waits-for-writer"
guards = "Reading published relay configuration never acquires the exclusive relay writer lock."
file = "packages/core/src/native-account-runtime.ts"
old = ''' async getRelayConfig() {
const { mode, paths, store } = await selectedStorage()'''
new = ''' async getRelayConfig() {
const { mode, paths, store } = await selectedStorage()
// NON-VACUITY BREAK: restore relay writer contention on the request path.
await withLock(paths.config, { ...POOL_LOCK_DEFAULTS, name: 'native-relay' }, async () => {})'''
test_file = "packages/core/src/tests/native-account-runtime.test.ts"
runner = "command"
command = ["bun", "scripts/run-mutation-bun.ts", "packages/core/src/tests/native-account-runtime.test.ts", "{test}"]
test_count_pattern = "CKDEV executed {count} tests"
expect_red = ["relay config reads published state while another writer holds native-relay"]
expect_message = "error: expect(received).toBe(expected)"
broad_command = ["bun", "scripts/run-mutation-bun.ts", "--broad", "packages/core", "tmp/mutations/core.xml"]
broad_report = "tmp/mutations/core.xml"
broad_id = "{name}"

[[control]]
id = "native-relay-generation-agreement"
guards = "A relay reader never combines the old URL with a token published by another generation."
file = "packages/core/src/native-account-runtime.ts"
old = "if (generation !== state?.relayGeneration) continue"
new = "if (false && generation !== state?.relayGeneration) continue // NON-VACUITY BREAK: ignore crossed relay generations."
test_file = "packages/core/src/tests/native-account-runtime.test.ts"
runner = "command"
command = ["bun", "scripts/run-mutation-bun.ts", "packages/core/src/tests/native-account-runtime.test.ts", "{test}"]
test_count_pattern = "CKDEV executed {count} tests"
expect_red = ["relay reader racing a writer never combines old URL and new token (stamped)"]
expect_message = "error: expect(received).toMatchObject(expected)"
broad_command = ["bun", "scripts/run-mutation-bun.ts", "--broad", "packages/core", "tmp/mutations/core.xml"]
broad_report = "tmp/mutations/core.xml"
broad_id = "{name}"

[[control]]
id = "sticky-routing-decision-never-joins-writer"
guards = "A request reads persisted session pins and decides its route without joining a writer lease."
file = "packages/core/src/sticky-routing.ts"
old = " if (!input.sessionId) return null\n this.recoverLocalPins()"
new = " if (!input.sessionId) return null\n // NON-VACUITY BREAK: decide a request only after joining the writer lock.\n const decisionLease = await this.acquireLock()\n await decisionLease.release()\n this.recoverLocalPins()"
test_file = "packages/core/src/tests/sticky-routing-contention.test.ts"
runner = "command"
command = ["bun", "scripts/run-mutation-bun.ts", "packages/core/src/tests/sticky-routing-contention.test.ts", "{test}"]
test_count_pattern = "CKDEV executed {count} tests"
expect_red = ["sticky routing decisions read published pins without waiting and publish after the writer releases"]
expect_message = "error: expect(received).toBe(expected)"
broad_command = ["bun", "scripts/run-mutation-bun.ts", "--broad", "packages/core", "tmp/mutations/core.xml"]
broad_report = "tmp/mutations/core.xml"
broad_id = "{name}"
4 changes: 2 additions & 2 deletions packages/core/scripts/check-native-type-closure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ test('packed Core types and Node runtime work in a fresh consumer without common
hold: (point, id) => { const name: 'refresh-before-provider' | 'pull-before-request' = point; void [name, id]; },
logger: { warn: (message) => { const text: string = message; void text; } },
onLockEvent: (event) => {
const phase: 'acquired' | 'released' | 'contended' = event.type;
const phase: 'acquiring' | 'acquired' | 'released' | 'contended' = event.type;
const diagnostic: NativeLockEvent = event;
const fields: string[] = [event.name, event.path];
void [phase, diagnostic, fields];
Expand All @@ -436,7 +436,7 @@ test('packed Core types and Node runtime work in a fresh consumer without common
compatible.onLockEvent?.(oldProducerRecord);
const contention: Parameters<NonNullable<NativePoolStoreOptions['onLockEvent']>>[0] = { type: 'contended', name: 'synthetic', path: paths.state };
options.onLockEvent?.(contention);
type ClosedEvent = NativeLockEvent['type'] extends 'acquired' | 'released' | 'contended' ? true : false;
type ClosedEvent = NativeLockEvent['type'] extends 'acquiring' | 'acquired' | 'released' | 'contended' ? true : false;
const closed: ClosedEvent = true;
void closed;
const roster: string = paths.roster;
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export type {
} from './native-local-credential-service.ts'
export { createNativeLocalCredentialService } from './native-local-credential-service.ts'
export type { NativeLocalExternalPolicy } from './native-local-runtime-readers.ts'
export type { NativeLockEvent } from './native-lock-observer.ts'
export type {
NativeMenuActionValues,
NativeMenuCapabilityOutcome,
Expand Down Expand Up @@ -191,6 +192,7 @@ export type {
NativeLocalFailurePolicy,
NativeLocalFailureSkipReason,
} from './native-runtime.ts'
export { NativeRuntimeError } from './native-runtime.ts'
export { nativeRuntimeOptionIdentity } from './native-runtime-registry.ts'
export * from './native-settings.ts'
export {
Expand Down
Loading
Loading