Repository navigation
Conversation
Two things, and the second is the one that mattered more than expected. **Saved destinations.** Where to ask was three loose defaults keys and one Keychain item, which is right while the answer is always "the fleet downstairs". It stops being right at the second destination: a private vLLM at work, somebody's OpenAI key for a comparison, a fleet at another site. Switching meant retyping a URL, a certificate path and a model, and losing whichever one you were not using - along with its key. Each destination is a record now, with its own Keychain item filed under its id, and Settings has a picker with add, duplicate and delete. Deleting forgets the key too: a credential outliving the thing it was for is a secret nobody is looking after. Duplicate deliberately does not copy the key, because the common reason to duplicate is the same server with different credentials, and carrying one over silently would be the wrong guess in exactly that case. The migration keeps a fixed id rather than a fresh one. The key saved before endpoints existed sits under the old account name, and only a known id lets the app find it again - a fresh UUID would have presented a migrated endpoint that silently could not authenticate. The old defaults keys are left in place, since a migration that deletes its own source cannot be re-run after a bug is found. **And the wire format is now tested.** Every existing test asserted what this client does with a reply; none asserted what it sends, which is the half that decides whether any of the above works. "It is an ordinary OpenAI client" was true by inspection and by nothing else. So there is a local listener that speaks the minimum of the protocol and records the request. No key, no spend, nothing leaves the machine, and it runs in CI. It checks the path, the bearer header, the model and max_tokens, the four-message shape, and that the retrieved passages ride in the final user turn rather than the system prompt - which is a prompt-cache property that was a comment and is now an assertion. 97 tests.
make-app.sh borrows dAI's compiled Metal shader bundle, because SwiftPM cannot build MLX's shaders and standing up a second xcodebuild for this package would be the same work twice. It resolved it at ../agent/.xcbuild/... which was correct while this app lived inside dAI's tree and stopped being correct the day it moved out. Not a build failure, which is the problem. The path is missing, the script prints a warning, the build succeeds, and the app it produces dies at the first embedding with "Failed to load the default metallib" - a runtime abort whose message names Metal rather than a moved directory. Found by launching the app, which is the only thing that would have found it. It now checks DAI_CMLX_BUNDLE, then a sibling dAI checkout, then the old in-tree layout for anyone who still has one, and the warning says which paths were tried and what to do about it. Verified by building and running: the bundle is embedded, the app launches, and Settings reports 9 models offered from the live fleet.
Owner
Author
Added: a regression from the repository split
It fails in the worst available way: the path is missing, the script prints a Now checks Verified by running it, not just building it
|
App Transport Security blocks http:// by default. Correct for the internet, and wrong for what this app was just taught to do: the private OpenAI-compatible servers worth pointing it at are LM Studio on 127.0.0.1:1234, Ollama on 11434, a vLLM on the bench - all of them plain http. Without an exception the request fails before it leaves the process, with an error about a secure connection rather than about the server, which sends you looking at the wrong end. NSAllowsLocalNetworking is the narrow form: loopback, .local and unqualified names. It does not permit arbitrary http to the internet, and a public endpoint is https anyway. Found by configuring LM Studio as a destination and noticing the bundle had no ATS key at all - saved-destinations would have shipped able to save a local destination and unable to call it.
Reported as "I lost the configuration for the dAI fleet". It was not lost, it was overwritten: the Fleet record held name "New destination" and baseURL "https://" while keeping its id and its Keychain item. Two writers, one deferred. The picker had .onChange(of: selectedID) saving the fields on screen into the previous endpoint, and add() also set selectedID and then loaded the new endpoint's values into those fields. SwiftUI runs onChange after the view update, so by the time the handler ran the fields already held the new endpoint - and it did exactly what it was told, writing them into the one just switched away from. Switching is a binding now: persist, change, load, in one synchronous sequence with no second writer, so ordering cannot be the question. Recovering it was luck of a kind that was at least deliberate. The migration leaves the original defaults keys in place - written as insurance against a migration found to be wrong - and they still held the URL and CA path, so the record could be rebuilt exactly. Without that this would have been unrecoverable from anything on the machine. The new test does not catch this and says so. The store was never at fault; the bug was ordering between two callers in the view, and nothing at this layer can see that. What it pins is the guarantee the view relies on: saving one endpoint must not disturb another. The bug itself was found by using the app, which is the second time today that has been the thing that worked. Also: the credential hint said "an operator mints one with POST /admin/v1/auth/keys" regardless of destination, which is true of a fleet and nonsense for OpenAI. Off-fleet it now points at the provider, and says that a local server ignoring credentials still needs something in the box - without that sentence, being asked for a key by a server that does not want one reads as a bug. 98 tests.
Reported while it was happening: "as I was entering details for http://localhost:1234, the models from fleet were being offered". Exactly that, and for a duller reason than a race. loadModels() built its client with AskBar.gateway(), which reads the *saved* selection out of the store. The store does not learn about a switch until the next persist, so Refresh asked the previous destination - nine fleet models listed beside an LM Studio URL, with the chosen model marked "not offered now" because the fleet has never heard of qwen3.6. The same cause meant typing a new URL and pressing Refresh queried the old one, which is worse: it makes the button look like it works while it reports on somewhere else. It now builds the client from the fields on screen, which is what a person pressing Refresh while typing a URL means by it. A generation counter goes with it, for the failure that would have been left: a slow fleet answering after the switch overwriting a fast local server's list. Identical symptom, different cause, and fixing only the first would have left something intermittent behind - which this project has paid for before. Three labels assumed a fleet and now do not: "Refresh from fleet" becomes "Refresh from server", "Whatever the fleet is serving" becomes "Choose a model", and the CA field's placeholder stops advising an installer path at a public server where the answer is to leave it empty. One compile note kept because it will recur: the refresh label is a computed property because the ternary written inline defeated the type checker outright - "unable to type-check this expression in reasonable time". 98 tests.
Two reports, two silent failures. **Dark mode came up light every launch.** App.init() calls Appearance.current.apply(), which did `NSApp?.appearance = ...`. NSApp is nil until the application instance exists, and in init() it does not - so the optional chain evaluated to nothing and the assignment was discarded without a word. The setting saved, the toolbar agreed with itself, and the window was light. The comment above the call explains it runs early deliberately, to avoid flashing the system appearance, which is exactly why it never worked. NSApplication.shared creates the instance if it is absent, so the same call at the same moment now lands. apply() is @mainactor too, which is what it always should have been - and is the strict-concurrency error that pushed CI onto a newer runner image. **LM Studio on 127.0.0.1 was classified as a fleet.** looksLikeFleet asks whether the address is private, and a loopback address is. True of the network, false of the server: the label said "Refresh from fleet" beside a LM Studio URL, and more seriously the model requirement was waived for a server that enforces it. Left alone, a local vLLM with no model chosen would have been let through to a 400 reading like a bad key. So a destination can now say what it is - Work it out / dAI fleet / OpenAI-compatible - and a declaration beats the inference. Optional rather than a plain Bool so records written before this decode as "work it out" and behave as they did. The heuristic stays as the default because it is right most of the time; what it cannot be is the only answer available. 100 tests.
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.
Lets the notebook be pointed at more than one OpenAI-compatible endpoint - a dAI
fleet, a private vLLM, OpenAI - and saves each by name.
Why
Where to ask was three loose
UserDefaultskeys and one Keychain item. Finewhile the answer is always "the fleet downstairs"; wrong at the second
destination. Switching meant retyping a URL, a certificate path and a model, and
losing whichever one you were not using along with its key.
What changed
EndpointandEndpointStorein NotebookKit - a list of named destinations,each with URL, CA path and model, plus which one is in use.
forgets its key, so a credential does not outlive the thing it was for.
deliberately does not copy the key: the usual reason to duplicate is the
same server with different credentials.
OpenAI · needs a modelbeats a 400 at the next question that reads as a badkey.
Migration
A single-destination installation becomes one endpoint named "Fleet", on first
open of Settings. It keeps a fixed id, not a fresh one: the pre-existing key
is filed under the old account name and only a known id lets the app find it
again. A fresh UUID would have produced a migrated endpoint that silently could
not authenticate. The legacy keys are left in place so the migration can be
corrected and re-run.
The part that was overdue
Every test in this repo asserted what the client does with a reply. None
asserted what it sends - the half that decides whether any OpenAI-compatible
endpoint works at all. "It is an ordinary OpenAI client" was true by inspection
and by nothing else.
OpenAIWireTestsstands up a local listener that speaks the minimum of theprotocol and records the request. No key, no spend, nothing leaves the machine,
and it runs in CI. It asserts the path, the bearer header,
modelandmax_tokens, the four-message shape, and that retrieved passages ride in thefinal user turn rather than the system prompt - a prompt-cache property that was
a comment and is now checked.
Verification
97 tests pass, up from 89.
EndpointStoreTestsruns against a scratchUserDefaultssuite rather than.standard, so it cannot rewrite thedeveloper's own settings while it runs.
Not done
Nothing here has been exercised against a real third-party provider - that needs
a key and a human. The wire format is asserted against a stub; the last mile is
adding a real endpoint in Settings and pressing Test Connection.
🤖 Generated with Claude Code
https://claude.ai/code/session_0157siweEqdaNhvgsQXPenzW