Skip to content

perf(env): memoize + claim-scope host probe — 12s→0.4s default env create#240

Merged
Koukyosyumei merged 2 commits into
mainfrom
improve-env-create
Jun 29, 2026
Merged

perf(env): memoize + claim-scope host probe — 12s→0.4s default env create#240
Koukyosyumei merged 2 commits into
mainfrom
improve-env-create

Conversation

@Koukyosyumei

Copy link
Copy Markdown
Collaborator

No description provided.

…eate

A default `h5i env create` re-ran `probe_host()` 9 times, each shelling
out to `podman info` (~1.3s) — ~12s of pure runtime probing for a tier
(supervised) that never consults the container runtime.

Two layers of fix:

1. Memoize `probe_host()` in a process-wide OnceLock (host kernel + Podman
   capabilities are immutable for a process's life; never persisted so a
   later process re-probes).

2. Probe Podman only when a container tier with an image is actually in
   play. `resolve` reads container_runtime solely inside the Container arm
   (after the image check), so:
   - split into `probe_host` (full) vs `probe_host_kernel` (no Podman
     shell-out) + `probe_host_for(claim)` selector;
   - `effective_auto` skips the imageless Container candidate and probes
     per-tier scoped;
   - `supervisor::probe` uses the kernel-only probe (only ever read kernel
     bits);
   - the post-create discoverability tip uses a cheap `podman --version`
     presence check instead of full `podman info`.

Auto-pick still lands on supervised; container resolve + env probe/doctor
still get the full Podman-aware probe. ~30x faster (12.2s→~0.4s), zero
`podman info` calls on the default path.
@Koukyosyumei Koukyosyumei changed the title Improve env create perf(env): memoize + claim-scope host probe — 12s→0.4s default env create Jun 29, 2026
@Koukyosyumei

Copy link
Copy Markdown
Collaborator Author

🪙 50% AI-authored · 4 files · prompt 60/100

1 AI commit

1 / 241 : 2.81 / 2
AI commitsfiles touchedREAD : EDITTHINKs / ops

💬 The ask

"When agents can notice the submitted review? Do hooks capture them? Release this v0.2.5 are you fine? Do you think the env's proposal from env/human/improve-start-time-codex is nice to merge to improve the speed of h5i env create wit…"

📍 What shipped

  • ✓ Cache process-tier exec self-test
  • ✓ perf(env): memoize + claim-scope host probe — 12s→0.4s default env create

Note

🌿 Prompt maturity: 60/100 · proficient · 1 prompt scored (100% of AI commits)
Heuristic signal of prompt craft — not a developer rating.

📊 heuristic breakdown
Dimension Signal
Specificity █████████░ 0.89
Control / acceptance █████░░░░░ 0.53
Context grounding ███████░░░ 0.70
Structure ███░░░░░░░ 0.25
Lexical diversity ████████░░ 0.77
Clarity (readability band) ██████████ 1.00
Length adequacy ██████████ 1.00

Readability (display-only): Flesch 64 · FK grade 8.0 · Gunning Fog 10.2

Offline classical-NLP score — no LLM. Higher = more specific, bounded, and grounded prompting.

Tip

✅ Security scan clean

No credentials leaked in this branch's diff. h5i scanned every added line against the secret rule pack and found nothing to rotate.

Note

Duplicate-code scan clean — no copy-paste blocks introduced.

🧠 Reasoning by file — 10294 nodes across 5 lanes, latest 24 only
%%{init: {"flowchart": {"nodeSpacing": 42, "rankSpacing": 48, "diagramPadding": 14}, "themeVariables": {"fontSize": "18px"}} }%%
flowchart TB
  subgraph lane_0["💭 Reasoning · 9 steps"]
    direction LR
    n_lane_0_0["THINK · Let me restructure the probe into a kernel-only path + a claim-scoped se…"]:::t
    n_lane_0_1["THINK · Let me find where `env run` resolves its policy (the frequent path) and …"]:::t
    n_lane_0_2["THINK · Let me find all callers of `container::probe()` and check if the agent p…"]:::t
    n_lane_0_3["THINK · Let me instrument the full `probe_host()` to dump a backtrace and find t…"]:::t
    n_lane_0_4["THINK · Let me confirm that and then run clippy + the full suite, since this tou…"]:::t
    n_lane_0_5["THINK · Let me smoke-test that `env probe` still reports the container runtime c…"]:::t
    n_lane_0_6["THINK · Let me test whether fsync is a factor (a potentially safe win for a *dis…"]:::t
    n_lane_0_7["THINK · Let me confirm the working tree is clean (committed work intact) and — i…"]:::t
    n_lane_0_8["NOTE · DEFERRAL (~/Dev/h5i/src/main.rs): rift, confirmed identical on the paren…"]:::n
    n_lane_0_0 --> n_lane_0_1
    n_lane_0_1 --> n_lane_0_2
    n_lane_0_2 --> n_lane_0_3
    n_lane_0_3 --> n_lane_0_4
    n_lane_0_4 --> n_lane_0_5
    n_lane_0_5 --> n_lane_0_6
    n_lane_0_6 --> n_lane_0_7
    n_lane_0_7 --> n_lane_0_8
  end
  subgraph lane_1["📄 src/env.rs · 8 ops"]
    direction LR
    n_lane_1_0["READ × 2"]:::o
    n_lane_1_1["EDIT × 6"]:::a
    n_lane_1_0 --> n_lane_1_1
  end
  subgraph lane_2["📄 src/main.rs · 3 ops"]
    direction LR
    n_lane_2_0["READ"]:::o
    n_lane_2_1["EDIT × 2"]:::a
    n_lane_2_0 --> n_lane_2_1
  end
  subgraph lane_3["📄 src/container.rs · 2 ops"]
    direction LR
    n_lane_3_0["READ"]:::o
    n_lane_3_1["EDIT"]:::a
    n_lane_3_0 --> n_lane_3_1
  end
  subgraph lane_4["📄 src/sandbox.rs · 2 ops"]
    direction LR
    n_lane_4_0["EDIT × 2"]:::a
  end
  classDef o fill:#dbeafe,stroke:#1e3a8a,color:#0b1c4a;
  classDef t fill:#fef3c7,stroke:#92400e,color:#3f2d05;
  classDef a fill:#dcfce7,stroke:#166534,color:#0a2e16;
  classDef n fill:#ede9fe,stroke:#5b21b6,color:#221251;
  classDef m fill:#e5e7eb,stroke:#374151,color:#0b0f17;
Loading
💬 Agent coordination — 4 messages across 4 threads

From refs/h5i/msg @ 9dc5cbb · branch improve-env-create · review-typed excerpts only · --no-msg to omit, --msg-bodies for full.

🟡 ASK · human → milo · 2026-06-29 22:09 — 'h5i env create' is currently slow, and I want to improve this speed without sacrificing any security gurantee or usability

🟡 ASK · human → iris · 2026-06-29 22:09 — 'h5i env create' is currently slow, and I want to improve this speed without sacrificing any security gurantee or usability

🟡 ASK · human → milo · 2026-06-29 22:08 — is currently slow, and I want to improve this speed without sacrificing any security gurantee or usability

🟡 ASK · human → iris · 2026-06-29 22:08 — is currently slow, and I want to improve this speed without sacrificing any security gurantee or usability

Note

🪙 Token reduction — 8 captured tool outputs kept out of context: 64229 → 1752 tokens (97% saved, 62477 tokens). Full output is recoverable with h5i recall object.

By tool
Tool Captures Raw Summary Saved
cargo 5 62607 115 99%
bash 3 1622 1637 0%

📜 Per-commit provenance

ce63fc89 perf(env): memoize + claim-scope host probe — 12s→0.4s default env create

  • promptWhen agents can notice the submitted review? Do hooks capture them? Release this v0.2.5 are you fine? Do you think the env's proposal from env/human/improve-start-time-codex is nice to merge to improve the speed of h5i env create without sacrifying security or usability? …
    • 🌿 prompt maturity 60/100 proficient
  • model claude-opus-4-8 · agent claude-code

Generated by h5i · re-run h5i share pr post to refresh.

@Koukyosyumei Koukyosyumei merged commit 80b3436 into main Jun 29, 2026
5 checks passed
@Koukyosyumei Koukyosyumei deleted the improve-env-create branch June 29, 2026 23:28
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