Repository navigation
feat(gaffer): OpenCode for Gaffer 0.3.0 on the Blender and Houdini model - #33
Merged
Merged
Conversation
Gaffer's OpenCode Link only offered a script while its in-app panel was connected, so a CodeNomad conversation alone could not use Gaffer; it had no code execution, inspection, verification, save or render task, and its requests waited on Gaffer's main thread without limit. The installed part now starts with Gaffer's interface and offers each open script as its own offer, labelled with its file (numbered when two scripts share one), renewed straight at the services that took it and withdrawn when the script closes. OPENCODE_GAFFER_OFFER=0 keeps it quiet; a background gaffer python never offers itself. Requests go through a gate that never blocks the request's thread: GafferUI.EventLoop.executeOnUIThread queues them (pump() in gaffer python), a request reached from a nested event loop while another runs is put back, and one the main thread has not taken within 10 s is answered busy with what runs and since when. status and hello answer off the main thread (hello from values read once at startup). execute_code runs on the attached script in one Gaffer.UndoScope; a failure after a change is undone and the script compared with its serialisation: restored, or quarantined until release with the revision of a read (apply's failed rollback uses the same quarantine). Hints are read in Gaffer, measured on 1.7.1.0: closest children or plugs of a KeyError, closest attributes or classes, the value type a plug's setValue takes with the C++ signature, the plug a ProcessException failed on with the node's expression or file, the types of plugs that cannot connect, a module not imported. The plugin uses the kit's host session like Houdini: automatic attachment on first use, attachments kept across restarts, the working method as an instructions entry (replacing the gaffer-graph skill and the system sentence), readable host errors, a Gaffer closed (no crash report in Gaffer) or frozen said as such, same_label, and read-only detection of the earlier installation (~/gaffer/startup/gui/openCode.py, ~/gaffer/OpenCode). Tools come from manifests: gaffer_hosts, gaffer_context (+ release_quarantine), gaffer_apply (unchanged operations, permission gaffer_write), gaffer_execute_code, gaffer_inspect, gaffer_verify (criteria, computation errors, saved by a background gaffer python followed outside Gaffer and bounded by timeout_s), gaffer_save, gaffer_render (a task node as a background task; cancelling stops its whole process tree) and gaffer_install_host. The panel is a plain client of the installed part: its sidecar runs on Node instead of Bun, finds its script's offer by label and resumes the conversation marked for its script; it never announces nor withdraws. Tests: in a real Gaffer (GAFFER_TEST_BIN; CI's 1.7.6.0 job runs both) real_host.py covers offers per script, hello and status off the main thread, execute_code with undo, rollback, hints, quarantine and release, and the busy answer within 10 s while another request runs; programs_gaffer.py covers inspect, verify, saved verify, save and render tasks. Node tests port Houdini's plugin, registry, conformance, tasks and saved-verify suites, plus the panel's sidecar. They fail on the previous version (missing API, modules and behaviours). Real trials on a windowed Gaffer 1.7.1.0 on a hidden desktop with a private profile and a fake OpenCode service: the script offered 3 s after startup with no panel; the plugin attached it on the first call, ran code, programs and a two-frame render, answered busy in 10.0 s, and said a suspended Gaffer was not answering, then no longer offering.
…n, and says why a Connect failed
In the Gaffer trial, the panel's Connect failed while a CodeNomad
conversation was attached to the same script, and worked once that
conversation was detached; it looked like an exclusive attachment.
There is none: the kit's registry attaches several conversations to one
offer (only a conversation already bound to another application is
refused), and Houdini's panel uses the same path. The panel's
conversation lives in the script's folder, a Location OpenCode opens on
the first Connect there; the panel's first call to the integration's RPC
in that Location ("RPC is unavailable: neuralnomads.gaffer") came before
OpenCode had loaded its plugins, and the panel said only "Connection or
action failed". The second Connect, after the detach, found the Location
loaded.
The panel now treats an unavailable RPC while looking for its script's
offer as a Location still loading, and asks again within its offer wait,
raised to 30 s. A Connect that fails says which step failed (reaching
OpenCode, finding or creating the script's conversation, finding the
offer, attaching, loading the conversation) and the error's first line,
without a token, an authorization or a port; another panel action says
its error the same way.
Tests: the panel connects after two unavailable answers next to a
conversation attached to the same script, and closing it leaves that
conversation attached; a failed Connect names its step without
credentials (both fail on the previous commit with the trial's
message); through the plugin's real registry, the panel's attachHost and
a gaffer_hosts attachment hold the same script together and either
detach leaves the other. Real trial with the real OpenCode service and a
windowed Gaffer on a hidden desktop, a CodeNomad conversation attached
first to a script in a folder OpenCode had never opened: the previous
build reproduced the failure (now named "RPC is unavailable"), the fix
connected on the first Connect in 2 s; closing the panel kept the other
conversation attached, detaching that conversation kept the panel
connected, and attaching it again said "shared".
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.
OpenCode for Gaffer 0.3.0, on the Blender and Houdini model (S6)
Gaffer's OpenCode Link now lives with Gaffer, like Houdini 0.3.0's: it starts with Gaffer's interface and offers each open script to OpenCode, so a CodeNomad conversation alone can use Gaffer, without the in-app panel.
Installed part (
integrations/gaffer/host)GafferOpenCode.initialise(application)at GUI startup: the host, its listener and an advertiser that offers one offer per open script, labelled with its file (Gaffer: shot.gfr, numbered when two scripts share it), renewed straight at the services that took it; a closed script is withdrawn.OPENCODE_GAFFER_OFFER=0keeps it from offering.GafferUI.EventLoop.executeOnUIThread(orpump()ingaffer python); one the main thread has not taken within 10 s is answeredbusy, naming what runs and since when.statusandhelloanswer off the main thread (hellofrom values read once).execute_codeon the attached script in oneGaffer.UndoScope; a failure after a change is undone and the script compared with its serialisation: restored, or quarantined untilreleasewith the revision of a read.apply's rollback failure now uses the same releasable quarantine.KeyError, closest attributes or classes, the value typesetValuetakes (with the C++ signature), the plug aProcessExceptionfailed on with the node's expression or file, the types of plugs that cannot connect, a module not imported.Plugin (
integrations/gaffer/plugin)gaffer_hosts,gaffer_context(+release_quarantine),gaffer_apply(unchanged operations, permissiongaffer_write),gaffer_execute_code,gaffer_inspect,gaffer_verify(criteria, computation errors,savedby a backgroundgaffer pythonfollowed outside Gaffer withtimeout_s),gaffer_save,gaffer_render(a task node as a background task),gaffer_install_host.~/gaffer/startup/gui/openCode.py,~/gaffer/OpenCode) are detected read-only (legacy_install).gaffer-graphskill and the system sentence are replaced by the working method.Tests
GAFFER_TEST_BIN; the CI job downloads 1.7.6.0 and runs both):test/python/real_host.py(offers per script and labels,hello/statusoff the main thread,execute_codewith undo, rollback, hints, quarantine and release, busy within 10 s) andtest/programs_gaffer.py(inspect, verify with computation errors, saved verify, save, ImageWriter and Cycles render tasks). Locally on 1.7.1.0: both pass.npm test: 323 tests, 316 pass, 7 skipped (real applications without their binary).Real trials (windowed Gaffer 1.7.1.0 on a hidden desktop, private profile, fake OpenCode service)
No merge, no publication.