Fix config-scoped state and unchanged checkpoints#12
Merged
rowantrollope merged 1 commit intocodex/fix-hosted-mcp-token-issuancefrom May 6, 2026
Merged
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
9d6d0df
into
codex/fix-hosted-mcp-token-issuance
7 checks passed
rowantrollope
added a commit
that referenced
this pull request
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes two QA failures that were both caused by surface-level contract drift.
First,
afs fs create-exclusiverespected the selected config file for Redis/workspace settings, but it still loaded runtime state from the legacy global~/.afs/state.json. That meant an alternate--configcould point at the right workspace and still read the wrong sync runtime state, which brokecreate-exclusivein exactly the kind of copied-config test flow QA was exercising.Second, unchanged-workspace checkpoint creation behaved differently across surfaces. The CLI already treated an unchanged live workspace as a valid explicit checkpoint create, but the MCP checkpoint tools did not opt into that behavior. In practice that meant SDK users could call
checkpoint_create, get back a checkpoint name withcreated: false, and then immediately hit a restore failure because that named checkpoint had never actually been written.Those are both bad inconsistencies: the CLI path becomes config-sensitive in the wrong places, and the checkpoint contract changes depending on whether the caller goes through CLI or MCP/SDK.
What Changed
~/.afs/state.jsonpath so the normal CLI flow does not move unexpectedlyfs create-exclusiveignores a conflicting legacy state file when the selected config has its own runtime statecheckpoint_createwith the CLI contract by allowing unchanged explicit checkpoint savesAllowUnchangedis honored before the clean-workspace short-circuitTesting
go test ./cmd/afs -run 'TestCmdFileCreateExclusiveRoundTrip|TestCmdFileCreateExclusiveUsesConfigScopedState|TestAFSMCPCheckpointCreateAllowsUnchangedWorkspace'go test ./internal/controlplane -run TestHostedMCPCheckpointCreateAllowsUnchangedWorkspacego test ./cmd/afs ./internal/controlplanePYTHONPATH=src uv run python -m unittest tests.test_clientnpm testinsdk/typescriptmake test