Repository navigation
Replies: 5 comments 3 replies
|
Update: reference implementation following this proposal is ready and verified on our fork branch (
Holding off on opening an upstream PR so we can align on scope and fine-tune the contract from feedback in this thread first. |
|
Thanks, @smota, for a detailed proposal: the four places where a community runner's evidence is dropped today, each with the file and line, plus what you'd change, what you'd leave out and how you'd test it. We've received it, and we'll confirm here whether it fits before anyone builds it. If it does, would you like to build it yourself? |
|
@mvschwarz — a follow-up clarification to make the scope, current reference implementation and remaining work easier to assess alongside #2862. This follows the original integration discussion in #2854; it is not a new scope request.
Reference: observability branch, tip
The implementation discrepancies are ours to resolve, not decisions we are asking maintainers to approve. The earlier 223-test result belongs to an older revision; we are not presenting it as fresh verification of this tip. Alignment requested: does identity-by-hook plus model/usage-by-sidecar fit the intended boundary? Once scope is confirmed, we can tighten those guarantees and prepare a bounded, reviewable PR. Cancel/wake stays in #2862; compaction control, memory management, handover and learning workflows remain outside this proposal. |
|
Yes to extending the existing runner contract for these observations. Shell-drop detection belongs in OpenRig's own observations. Model and context supplied by a runner should be labelled runner-reported and bound to that run by a per-run credential. Session identity can be retained on the same basis, but a runner's claim alone must not be displayed as independently verified identity. Let's keep the meaning and provenance of these fields in the existing contract rather than add a separate route for each fact. That gives the observability work a clear scope without making every runner implement OpenRig's own observation machinery. |
Uh oh!
There was an error while loading. Please reload this page.
Problem & Use Case
Teams run persistent seats on community harnesses (
runner: true,launch_wrapper: true) such as Google Antigravity CLI (agy) in--input-format stream-json --output-format stream-jsonmode.The runner already knows the live child PID, native
conversation_id, runtime-selectedmodel, and per-step token usage (input_tokens,output_tokens,cache_read_tokens,thinking_tokens). However, OpenRig daemon currently drops or blocks these signals at four runtime-gated seams. Operators see permanentunknownorunconfirmedstates inrig ps,GET /api/rigs/:id/nodes, and Web UI even when the runner has direct runtime evidence.What breaks for operators today
unknown:ContextMonitor.getEligibleSessions(packages/daemon/src/domain/context-monitor.ts:278-288) restricts sidecar polling toruntime IN ('claude-code', 'stub', 'codex'). A community runner writing<OPENRIG_HOME>/state/context-usage/<sessionName>.jsonis ignored.ContextUsageStore.normalizeSample(packages/daemon/src/domain/context-usage-store.ts:200-239) parsesSidecarRaw(packages/daemon/src/domain/context-usage-store.ts:43) but dropsoccupant_generationand hardcodessource: "claude-statusline".unsupported-runtime:CurrentModelReader.prepare(packages/daemon/src/domain/model-divergence/current-model-reader.ts:209-215) gates on["claude-code", "codex", "pi"].launcher/unconfirmed:validateResumeToken(packages/daemon/src/domain/resume-token-validation.ts:98) rejectssession_identityhooks fromcommunity:*(packages/daemon/src/routes/activity.ts:561-574).SeatIdentityReconciler.classifyPaneRuntimeMatch(packages/daemon/src/domain/seat-identity-reconciler.ts:55) setsexpectsAgent = falseforcommunity:*(missing bare-shell drops), andcomputeVerdict(packages/daemon/src/domain/seat-identity-reconciler.ts:374-382) returns hardcoded{ verdict: "unconfirmed", reason: "process_identity_unconfirmed" }.Verified Seam Analysis
<stateDir>/context-usage/<sessionName>.jsononstep_update/result.context-monitor.ts:278-288SQL filter excludescommunity:*.context-usage-store.ts:200-239dropsoccupant_generation.availability: "unknown"community:*sessions (runner: true); persist and verifyoccupant_generation+ customsource.init.modelor invocation hook writesmodel: { id, source }to sidecar / hook after occupant boot.current-model-reader.ts:209-215rejects non-claude-code/codex/pi.status: "unknown",reason: "unsupported-runtime"CurrentModelReaderto read generation-verified model facts forcommunity:*with explicitsource(e.g.runner-stream-init).conversation_idoninit(including resume match) and postseventFamily: "session_identity".resume-token-validation.ts:98&routes/activity.ts:561-574rejectcommunity:*.tokenPersisted: false, provenance stays"launcher"community:*(launch_result: true/runner: true) whengenerationmatches active tenure.pi-style) and supervises native child (directly or underbwrap).seat-identity-reconciler.ts:55(expectsAgent = false) &line 374(unconfirmed).unconfirmedcommunity:*withrunner: true: treat bare shell in pane asmismatch; returnverifiedonly when runner + child process and generation-bound session identity match.Scope Diagram
Principles Preserved
agyadapter inpackages/daemon/src/adapters/. All changes extend the existingcommunity-harness(runner: true),ContextUsageStoresidecar,postHook, andSeatIdentityReconcilercontracts.init.modelor runner hook carriessource: "runner-stream-init"or"runner-invocation-hook", never"provider-response".context_window_sizeorused_percentage, OpenRig does not invent a percentage. It stores raw token counts and setsavailability: "unknown", reason: "window_capacity_unknown".community:*presets withoutrunner: trueand generation-boundsession_identityremainunconfirmed.<stateDir>/context-usage/<sessionName>.json,SidecarRaw.occupant_generation(already declared atpackages/daemon/src/domain/context-usage-store.ts:43), andPOST /api/activity/hooks.claude-code,codex,pi, orompverification paths.Exclusions (Out of Scope)
agyruntime type to OpenRig core./compactinjection) for community harnesses (packages/daemon/src/domain/claude-compaction-enforcer.tsremainsclaude-codeonly).Implementation Locations & Verification Plan
Implementation Locations
packages/daemon/src/domain/context-monitor.ts: Include runningcommunity_harnesssessions ingetEligibleSessionsand route tostore.readAndNormalizewithout Claude collector provisioning.packages/daemon/src/domain/context-usage-store.ts: Persist and checkoccupant_generationagainst active tenure; preserve sidecarsource; support raw token retention whenused_percentageis omitted.packages/daemon/src/domain/model-divergence/current-model-reader.ts: Add community runner sidecar/session model reader gated onoccupantUnchanged,occupant_generation, andobservedAt >= bootAt.packages/daemon/src/domain/resume-token-validation.ts&packages/daemon/src/routes/activity.ts: Accept generation-matchingsession_identityforcommunity:*withlaunch_result: trueorrunner: true.packages/daemon/src/domain/seat-identity-reconciler.ts: Detect shell drops (SHELL_COMMANDS) asmismatchforrunner: truepresets; promote toverifiedonly when runner process + generation-bound session identity are confirmed.Verification Plan
vitest):context-usage-store.test.ts: Verify sidecar ingestion forcommunity:*, customsourcepreservation,occupant_generationmismatch rejection (stale_generation), and missingused_percentagehandling.current-model-reader.test.ts: Verify model observation forcommunity:*afterbootAt, and rejection whengenerationorsession_idmismatches.seat-identity-reconciler.test.ts: Verifyrunner: truecommunity seat transitions (unconfirmed->verifiedon confirmed identity;mismatchon bare shell drop; stale generation callback rejection).run-scenarios.mjs):session_identityhook, stale generation rejection, and shell-drop mismatch in an isolated daemon + tmux harness.Future Ideas (Parked)
context_manifest_sha256field in sidecar/whoami to attest startup files and skill symlinks delivered by a runner.stream-jsonrunner template indocs/reference/alongside the Cursor example.PreInvocationhook example for harnesses that support mid-session model switching.All reactions