Skip to content

feat(gaffer): OpenCode for Gaffer 0.3.0 on the Blender and Houdini model - #33

Merged
pascalandr merged 2 commits into
mainfrom
feat/gaffer-0.3.0
Nov 16, 2026
Merged

pascalandr merged 2 commits into
mainfrom
feat/gaffer-0.3.0

Conversation

@pascalandr

Copy link
Copy Markdown
Collaborator

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=0 keeps it from offering.
  • A gate that never blocks a request's thread: requests go through GafferUI.EventLoop.executeOnUIThread (or pump() in gaffer python); one the main thread has not taken within 10 s is answered busy, naming what runs and since when. status and hello answer off the main thread (hello from values read once).
  • execute_code 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 rollback failure now uses the same releasable quarantine.
  • Hints read in Gaffer, measured on 1.7.1.0: closest children/plugs of a KeyError, closest attributes or classes, the value type 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.

Plugin (integrations/gaffer/plugin)

  • The kit's host session (automatic attachment on first use, attachments kept across restarts, the working method as an instructions entry, readable host errors), tools 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 with timeout_s), gaffer_save, gaffer_render (a task node as a background task), gaffer_install_host.
  • A Gaffer closed (Gaffer writes no crash report) or frozen is said as such.
  • Earlier installations (~/gaffer/startup/gui/openCode.py, ~/gaffer/OpenCode) are detected read-only (legacy_install).
  • The panel is a plain client of the installed part and its sidecar runs on Node instead of Bun; it resumes the conversation marked for its script.
  • The gaffer-graph skill and the system sentence are replaced by the working method.

Tests

  • Real Gaffer (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/status off the main thread, execute_code with undo, rollback, hints, quarantine and release, busy within 10 s) and test/programs_gaffer.py (inspect, verify with computation errors, saved verify, save, ImageWriter and Cycles render tasks). Locally on 1.7.1.0: both pass.
  • Node: the plugin, registry, conformance, tasks (a cancelled render stops its whole process tree), saved verify and the panel's sidecar. npm test: 323 tests, 316 pass, 7 skipped (real applications without their binary).
  • These tests fail on the previous version (missing API, modules and behaviours; the error-scan regression and the tree cancellation checked against the code before their fix).

Real trials (windowed Gaffer 1.7.1.0 on a hidden desktop, private profile, fake OpenCode service)

  • The script was offered 3 s after Gaffer started, with no panel, then renewed every 5 s straight at the service.
  • With that announced offer, the plugin attached the script on its first call, ran code (success, failure undone with its hint), inspect, save, verify, verify saved and a two-frame ImageWriter render task.
  • A request during a 14 s run was answered busy in 10.0 s; a suspended Gaffer was said not to answer, then (after the 15 s lease) no longer offering its script.

No merge, no publication.

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".
@pascalandr
pascalandr merged commit c7b0160 into main Nov 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant