[Phase 16] S6 — Invocation-owned resources: temp state, atomic writes, worker lifetime
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 24/100
Research direction
Start with the export_model path that builds the _merged_for_export directory and the try/finally placement around the merge, then read the atomic-write helper in forgelm/wizard/_state.py that the plan asks to promote. Also check tests/test_pipeline_orchestrator.py for the 32-writer stress pattern and the chat streamer's worker shutdown. Done means the five exit criteria pass, with a red-then-green reproducer for each unit. This spans four units across several subsystems, so it is better taken as a series of smaller issues.
Written by the indexing model from the issue text.
Description
Roadmap · Phase 16, step S6 · size M · 4 unit(s) · planned in
docs/roadmap/phase-16-trust-surface-hardening.md:449-479
Summary
A resource whose lifetime belongs to one invocation is named or owned globally. export_model derives <model_path>_merged_for_export by string concatenation, adopts any pre-existing directory at that path, overwrites it and then rmtrees it while returning success=True. The try/finally opens after the merge, so when the merge raises there is no cleanup at all and a user directory has already been partly clobbered; two concurrent exports of the same model collide on the same path.
Units
| Unit | Tracked by (October 2026 review) |
|---|---|
C33-EXPORT-TEMP-OWNERSHIP (= CLI-01 + GAP-01) |
#567 · #705 |
F-W20260729-TRUST-10 |
#551 |
F-W20260729-CLI-19 |
#691 · #706 |
F-W20260729-CLI-08 |
#567 · #691 · #705 |
Plan
- One discipline throughout: allocate uniquely, bind cleanup to the handle returned at creation, and release it in
finally. - Promote the atomic-write primitive local to
forgelm/wizard/_state.pyto a shared utility. - Keep the scratch directory in the model's parent, not the system temp dir — a merged 70B fp16 checkpoint would trade a data-loss bug for an ENOSPC bug.
Exit criteria
- A pre-existing scratch directory containing a sentinel survives byte-identical on export success and on merge failure; two sequential exports use different scratch directories.
-
shutil.rmtree(..., ignore_errors=True)is replaced by a loggedOSError. - The 32-concurrent-writer ingest stress pattern from
tests/test_pipeline_orchestrator.pyis ported and leaves no orphan temp files. - A mid-write exception leaves the previous deploy / quickstart destination bytes unchanged.
- A timed-out chat streamer terminates its worker within a bounded time.
How to deliver
- One root-cause family, committed on its own; then an Opus review round and a Sonnet review round, each with verified findings fixed and committed before the next step begins.
- A reproducer that is red before the fix and green after; the full gauntlet from
CLAUDE.mdpasses under./.venv/bin/python. - Every English documentation edit ships with its Turkish mirror in the same commit; a new or renamed audit event gets its EN and TR catalog rows in the same PR.
- A step that grows a deferred module carries its
budget_historyjustification in the same diff; a widened guard rolls out non-strict first, then flips. - Commit bodies cite
Absorbs F-W20260729-…; the CHANGELOG[Unreleased]section gets an entry only for a change a user or library consumer can observe (decision C-20).
Planned in docs/roadmap/phase-16-trust-surface-hardening.md (read at f94595f). Unit IDs (F-W20260729-…) come from the 2026-07-29/30 full-project review; the issue numbers next to them are the October 2026 review's records of the same defects.
- Dominant language
- Python
- Stars
- 9
- Forks
- 1
- Avg merge
- 8h 10m
- Merged PRs (30d)
- 5
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from HodeTech/ForgeLM
-
area: dev-tooling bug severity: low source: roadmap wave: 4
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Site: the theme-locked --code-comment grey (#6a6f80) on the dark code surface is 3.8:1, below WCAG AA, in both themes (F-W1-SITE-06)Possibly taken @vortsghost2025 claimed this today. Openarea: site bug good first issue severity: low source: review-2026-09 wave: 4
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
documentation good first issue severity: medium source: review-2026-09 wave: 3
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
documentation good first issue severity: low source: review-2026-09 wave: 4
Difficulty 1/5 1-3 hours Newbie friendliness 80/100
-
documentation severity: medium source: review-2026-09 wave: 3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
All issues in HodeTech/ForgeLM
Similar issues
-
[Bug]: LangGraph Store sync put bypasses namespace validationPossibly taken @ktz03 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
volcengine/OpenViking#6050 ·
Maintainers usually reply within 1 day
-
[Bug]: Streamed /v1/chat/completions sends unredacted agent error text (keys) in the final chunkPossibly taken @rodricksz4h5 claimed this today. Openarea/streaming comp/gateway P2 type/security
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NousResearch/hermes-agent#138245 ·
Maintainers usually reply within 1 day
-
[oblt-aw][autodoc] Update user onboarding guide for mandatory trigger CODEOWNERS stepPossibly taken @github-actions claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
correction metadata
Difficulty 2/5 Under an hour Newbie friendliness 68/100
acl-org/acl-anthology#10378 · 1 comment ·
Maintainers usually reply within 1 day
-
cloudtrail_multi_region_enabled_logging_management_events fails when the advanced event selector has a custom namePossibly taken @12YYCCYY16 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
prowler-cloud/prowler#13033 ·
Maintainers usually reply within 1 day