Skip to content

fix(o108): exec_background layer-3 protected-path snapshot on full exit - #103

Merged
QiaolongLi1201 merged 1 commit into
mainfrom
fix/o108-exec-background-l3
Oct 11, 2026
Merged

QiaolongLi1201 merged 1 commit into
mainfrom
fix/o108-exec-background-l3

Conversation

@QiaolongLi1201

Copy link
Copy Markdown
Collaborator

Summary

O108 — wire O101 Layer 3 (takeProtectedPathSnapshot before/after + diff) to exec_background complete-exit (close/error), not when the tool returns a job id while the process is still running.

Known limitation from O101-grok: L3 was only on foreground exec. After O107 (#102), this closes that gap.

What changed

  • src/tools/background-exec.ts: snapshot before spawn; on full exit run same helpers as foreground (diff / filterExpectedGitMetadataChanges / formatProtectedPathModifiedNotice); append 「已被修改」 notice to buffer; store protectedPathChanges on the proc.
  • src/core/tools/background-process-registry.ts: optional protectedPathChanges on proc + snapshot (paths/kind only).
  • src/cli/run-completion.ts + run-outcome.ts: noteBackgroundProtectedPathMods harvests finished bg snaps into the tracker (dedupe by path+kind); resolveRunOutcome calls it so late exits still → incomplete / non-zero.
  • README + snapshot header: exec_background covered on full exit; &/nohup inside a foreground command and writes after Moss itself exits remain known limits.
  • test/o108-exec-background-l3.spec.mjs: delayed ssh/hooks detection; benign no FP; outcome incomplete; late-exit harvest without marker in tool result; messaging; no secret leakage.

No new kill-switch. Reuses O101 protected-path definitions — no duplicate list.

Attribution

  • Developer (this PR): implementation, tests, docs, packaging.
  • Grok (O101 draft): original L3 helpers + known-limitation note that exec_background was unwired.
  • Moss: not used for this packaging turn.

Test plan

  • node --test test/o108-exec-background-l3.spec.mjs → 6/6 pass
  • node --test test/o101-indirect-writes.spec.mjs test/background-exec.spec.mjs test/run-completion-o98.spec.mjs → pass
  • npm run check (format / lint / typecheck) → green
  • QA security review (tighten-only; no plaintext secrets in notices)
  • UX: 「已被修改」 not 「已拦截」; inspect hints; incomplete last line

Spec

/workspace/specs/O108.md (UX/QA acceptance stubs for them to fill)

Base: 048aa1f7 (#102 O107 merge tip)

…nd exit

Run the same takeProtectedPathSnapshot/diff helpers on background process
close/error (full exit), not when the tool returns a job id while still
running. Append 「已被修改」 notice to the buffer; fold hits into the run
outcome tracker via noteBackgroundProtectedPathMods so late exits still
mark incomplete / non-zero. Docs: exec_background covered; &/nohup and
post-Moss-exit writes remain known limits.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@QiaolongLi1201
QiaolongLi1201 merged commit f038a16 into main Oct 11, 2026
6 of 12 checks passed
@QiaolongLi1201
QiaolongLi1201 deleted the fix/o108-exec-background-l3 branch October 12, 2026 10:29
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