Updating Matsya configurations¶
Summary
This page describes how a Matsya configuration is prepared on a developer's computer, published to the service, selected for a job or a question, compared with another on the same source and made the default. The service keeps every published configuration unchanged under its ID, pins the ID to each job and turn when it accepts the request, and changes its default without a restart. A request without an ID uses the service's current default.
Relationship with other documents
Builds on — Matsya developer guide §1, which identifies the program and the contents of a configuration. See also — What Matsya reads, for the instruction texts, settings and saved guides; The command reference §9 and Reaching the service by HTTP §8, the commands and routes of publication and selection.
1 What is selected¶
A configuration is a checked folder containing the instruction texts, settings, Matsya handlers, saved guides and manifest.json described in the developer guide §1. Its version is the human-readable value in the manifest. Its configuration ID is the SHA-256 digest of that manifest: a value that identifies the exact list of files and their digests. A published configuration is retained without modification, so an ID continues to name the same contents; a changed file produces a different ID.
The default configuration is the published ID the service selects when a request names no ID. A configuration ID is a selector, not a credential. A Matsya token authorizes a person's access to the service; the client must supply one whether or not a request names a configuration ID. Publishing configurations and changing the default require a separate administrator permission: the service reads a service-owned JSON file, named by MATSYA_CONFIG_ADMIN_GRANTS_FILE, with exactly one principal_ids array of the principal IDs allowed to do both, and reads it again at every such request, so that the operator grants or revokes the permission by replacing the file. An absent or invalid file grants the permission to no one.
The service keeps the published folders under MATSYA_CONFIGURATIONS_ROOT, each under its ID, and the register of selectable IDs, the default and the publication and default-change events in its job database. At a start whose register holds no default, the service installs the folder MATSYA_CONFIGURATION names under its ID and makes it the first default; at every start it moves an unlisted folder under the root aside and refuses to start without a registered, checked default. The retrieval index is a separate service input. Publishing a configuration does not rebuild or transfer it, and changing documents in a repository does not update the index or the saved guides already inside a published configuration.
2 Prepare and publish a candidate¶
- Start from a complete configuration folder. Change the chosen instruction texts, settings or Matsya handlers, assign a new version, regenerate its manifest and check every listed file. Keep a checked local copy named by the manifest's digest and a separate revision record naming its parent, added/changed/removed paths, reason and source-code commit. The register stays outside the checked folder: adding a record inside it would itself change the folder's ID. A candidate remains unchanged after publication.
- An administrator publishes that folder with
bellman-matsya configuration publish <folder>, orpublish_configuration(folder)of the Python module. The client sends the folder's files, by their paths relative to the folder, as a ZIP archive toPOST /v1/configurations. The service refuses a request from a principal the grant file does not name before it reads the archive; checks the archive's entries, refusing an absolute name, a.or..component, a backslash, a duplicate name, a file and a directory of one name, a link, any other non-regular entry, and a body or contents beyond 24 MiB; extracts the files into a staging folder under the root; checks every file against the manifest; importsmatsya_handler.pyand checks the whole configuration as a job would; checks the files again after the import; and then moves the folder under its ID and registers it with a publication event. A new ID answers 201 and an ID already published 200, each with the ID and the version. A refused archive installs nothing and leaves no selectable ID. Publishing the same contents again returns the same ID; it cannot replace the contents of an existing ID. - Keep the returned ID with the local revision record. Publication makes the candidate available for selection but does not make it the default, alter another user's job or update the retrieval index.
The administrator permission matters because a configuration includes matsya_handler.py, Python code that the service executes. A normal Matsya token is not sufficient to publish it; any Matsya token may select a published ID.
3 Select a configuration for work¶
A job request accepts an optional configuration_id. The client exposes it as --configuration-id <id> on bellman-matsya job submit and bellman-matsya project submit, and as the argument configuration_id of submit_job, start_job and project.submit. The same option is available on bellman-matsya ask and the Python ask for a conversation turn. When the ID is absent, the service uses its default; a user does not need a configuration ID for ordinary work. A malformed ID is refused with 422 and an unpublished one with 404, without creating work.
At submission, the service resolves the selected or default ID and stores it with the job in the transaction that accepts the request, before the job is queued, so that a concurrent change of the default and a submission take one definite order; a job that later fails or is cancelled keeps the ID. The worker reads the stored ID and loads that exact retained folder, verifying its manifest, even if the default changes while the job waits; it never takes the folder from the request or the then-current default, and a damaged folder fails the job with configuration_refused rather than falling back. The request's cycle limit is checked against the selected folder's settings. Job status and results return the resolved ID, so a locally saved record identifies what ran; the record's versions.configuration.manifest_sha256 equals it. A conversation turn likewise selects a configuration, which must enable the conversation role, else the question is refused with 422 and nothing is appended; a job the turn starts inherits its ID. If a job asks for more input, the continued attempt begun by the user's reply inherits that job's ID. A repeated delivery_id with the same question and selector returns the first turn and its ID even after the default has changed; a repeated delivery_id with another question or selector is refused with 409. Search requests still use the retrieval index and need no configuration selector.
4 Save and compare results¶
Run each candidate on the same directly submitted source text, target and other fixed inputs. A queued job built from a session can read entries added after submission, so a session revision does not fix its source for a controlled comparison. Each job's status carries three digests beside its configuration ID: request_sha256, the digest of the accepted request without the configuration ID, fixed at acceptance; source_sha256, the digest of the source text the job reads, fixed at acceptance for a directly supplied source and when the job starts for a session's text, a description stripped of surrounding whitespace and a paper unchanged; and index_digest, the digest of the retrieval index the job selected when it began. Each is null until fixed. Hold access grants, the index, saved guides, package code, comparator and token ceilings fixed across candidates; changing any of those requires a new comparison of both candidates under the new common inputs. Record a changed provider model in a candidate's settings explicitly.
bellman-matsya job export <job> <folder> [--overwrite], or export_job(job, folder, overwrite=...), saves the full job response as job.json, including its configuration ID and any status or error when no model files were produced. It refuses to replace an existing file unless --overwrite is given; --json prints the full response while saving it. The existing bellman-matsya job files <job> <folder> --all-iterates command saves available model files and the iteration record when a result exists. For a controlled pair of jobs, submit the same source text directly (--no-session in the CLI), target and source-cluster exclusions to each configuration; a session may change before a queued job begins. Organize exported records by source case and configuration ID.
The paired check reads two exported job.json files, their local configuration snapshots and the source as it was submitted, and sends no request:
meaning-map-config-pair records/case-1/<id A>/trial-1/job.json records/case-1/<id B>/trial-1/job.json \
snapshots/<id A> snapshots/<id B> \
--source-file case-1.md --source-kind description --output records/case-1/pair.json
The Python function is configuration_pair.compare_exports(left_job, right_job, left_snapshot, right_snapshot, source_kind, submitted_text) of the training harness. The record it writes has the schema matsya-configuration-pair/1, the two jobs' identifiers, states, errors, configuration IDs, request, source and index digests, whether each holds a full result and each result's status, and its comparison_state: comparable when both full results exist, their request, source and index digests are present and agree, each result's configuration files match its snapshot, and the two results agree on the index, the guides, the grants, the package versions, the comparator, the model key and the source cluster, and the two snapshots' ceilings are equal; refused, with the fields named, on a present mismatch, a wrong snapshot or a missing required field, even when the other job has no full result; and otherwise status_only, when either full result is absent or a job's provenance is unverified, retaining both outcomes and making no semantic claim. The command exits 0, 1 or 2 for the three states and writes pair.json in every case. A changed provider model between the two snapshots is reported, not refused. comparable means that the inputs were suitable for assessment, not that one candidate is better. Agreement of two adjacent elaborated semantic objects within one job answers whether that iteration converged; it does not by itself show that one configuration is better than another.
Collecting job records through the client and checking a pair are possible with this code. The development, held-out and control measures require a separate training-specification revision; a single architect job does not supply every trial needed for acceptance.
5 Make an accepted candidate the default¶
After the candidate meets the project's acceptance rule, an administrator selects its published ID as the new default with bellman-matsya configuration set-default <id>, or set_default_configuration(id), backed by PUT /v1/configurations/default, and records the choice with the installation. The service accepts only a published, checked ID, changes the default and writes its event, with the former and the new ID, in one database transaction, and answers with the former ID, the new ID and its version. The change is effective for the next request without a restart. This selection is separate from publication and from any individual job request. Jobs already submitted keep the ID resolved for them; subsequent requests without an ID use the new default, and GET /v1/index names the current default's ID and version.