ScobleClaw monorepo
Find a file
agent-cos 887ed949fa fix(opa): regenerate opa-policies-configmap from on-disk policies (eng#118, cycle 175)
Configmap was stale from commit 39b21dc; on-disk policies were updated
by scobleclaw#42 (commit bfe6e4c) but configmap was never re-applied.
This caused OPA /decision (OLD policy) to disagree with /allow and
/needs_l1 (NEW policy) for kamelet_ref=search-memory.

Re-generates the configmap from the current policies/*.rego files.
The configmap is also namespace-agnostic now (namespace field stripped
from the manifest) so it can be applied to scoble-policy namespace
via kubectl -n scoble-policy apply -f.
2026-06-09 20:42:42 -07:00
docs JUDGE-ARCH: Formalize actor-judge authorization layer 2026-05-23 19:31:30 -07:00
kubeclaw feat(pkg/floxenv): add Flox environment lifecycle management package 2026-05-29 23:40:22 -07:00
pkg/floxenv feat(pkg/floxenv): add Flox environment lifecycle management package 2026-05-29 23:40:22 -07:00
pool-manager feat(pool-manager): add /healthz handler for k8s liveness/readiness probes (#56) 2026-06-07 07:21:34 -07:00
scoble-policy fix(opa): regenerate opa-policies-configmap from on-disk policies (eng#118, cycle 175) 2026-06-09 20:42:42 -07:00
.gitignore feat(pkg/floxenv): add Flox environment lifecycle management package 2026-05-29 23:40:22 -07:00
coach-pattern-analysis.md Coach pattern analysis: root cause analysis of recurring 5/10 repetitive behavior critiques 2026-05-23 19:27:14 -07:00
go.mod feat(pkg/floxenv): add Flox environment lifecycle management package 2026-05-29 23:40:22 -07:00
README.md feat(pkg/floxenv): add Flox environment lifecycle management package 2026-05-29 23:40:22 -07:00

floxenv

Go package for managing Flox environment lifecycles via flox activate --detach.

Features

  • Activate — start a Flox environment and return an envID + PID.
  • Deactivate — graceful shutdown with SIGTERM then SIGKILL after a 10-second grace period.
  • IsAlive — lightweight, non-privileged process-existence check using zero-signal delivery.
  • Dev-mode stub — transparently falls back to a long-running shell command when flox is not installed (or when FLOXENV_DEV_MODE=1 is set), useful for CI and local development.

Installation

go get github.com/marcus/scobleclaw/pkg/floxenv

Usage

package main

import (
    "fmt"
    "log"

    "github.com/marcus/scobleclaw/pkg/floxenv"
)

func main() {
    r := floxenv.NewRegistry()

    envID, pid, err := r.Activate("/path/to/env/.flox/env/manifest.toml")
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("activated %s (pid %d)\n", envID, pid)

    // later …
    if err := r.Deactivate(envID, pid); err != nil {
        log.Fatal(err)
    }
}

Dev mode

When the flox binary is absent, or when FLOXENV_DEV_MODE=1 is set in the environment, the package runs a lightweight stub that forks a shell sleep process instead of invoking flox activate. This keeps dependent tests green in environments where Flox is not available.

Running tests

Unit tests (uses the dev-mode stub):

go test ./pkg/floxenv

Integration tests (requires a working Flox installation):

go test -tags=integration ./pkg/floxenv

API

Function Signature Description
NewRegistry () *Registry Create a new registry, auto-detecting dev mode.
(*Registry) Activate (manifestPath string) (envID string, pid int, err error) Activate a Flox environment.
(*Registry) Deactivate (envID string, pid int) error Shutdown an active environment.
IsAlive (pid int) bool Non-privileged process existence check.
(*Registry) List () []Info Snapshot of tracked environments.

License

MIT