Repository navigation
[GAP] Add Session::background_job_count jobs-count face (Refs #863) - #2869
Merged
Merged
Conversation
Count-only Session face for the host BackgroundJobs prompt segment (rubash#2859, GAP queue; ruling #863 comment 6675261066): the number of job-table entries with background == true and state in {Running, Stopped} after the cleanup_dead_jobs liveness pass — exactly the set bare `jobs` lists (GNU builtins/jobs.def:83 list_all_jobs, jobs.c:2254-2257). A ^Z-stopped foreground job counts (the stop path flips it to background = true); process-substitution children are not table entries and never count; a completed job never counts. Q-A count-only; Q-B rule (a) verified against GNU 5.3.20 first (P-J1 probe, 5/5: two bg Running list 2, ^Z-stopped fg lists 1, reaped / disowned / killed list 0); Q-C &mut self + cleanup_dead_jobs at read time, mirroring the listing path; Q-D JobCandidate stays engine-internal. 6 consumer pins (issue2859_*): one/two Running, reaped (+ repeated reads, no flicker), disowned, Stopped (+ CONT back to Running), procsub child never counts. Ledger §6 + §2.3 rows staged 0 (GAP-13 pattern); §6 279 -> 281. Refs #863, rubash#2859.
caomengxuan666
marked this pull request as ready for review
November 6, 2026 05:13
This was referenced Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[GAP] Add
Session::background_job_countjobs-count faceCount-only Session face for the host
BackgroundJobsprompt segment(rubash#2859, GAP queue; ruling niubash#863 comment 6675261066): the
number of job-table entries with
background == trueand state in{Running, Stopped} after the
cleanup_dead_jobsliveness pass —exactly the set bare
jobslists (GNU builtins/jobs.def:83list_all_jobs, jobs.c:2254-2257). A ^Z-stopped foreground job counts(the stop path flips it to
background = true); process-substitutionchildren are not table entries and never count; a completed job never
counts.
(P-J1 probe, 5/5: two bg Running list 2, ^Z-stopped fg lists 1,
reaped / disowned / killed list 0); Q-C
&mut self+cleanup_dead_jobsat read time, mirroring the listing path; Q-DJobCandidatestays engine-internal.Executor::background_job_countinsrc/executor/public_accessors.rs,Session::background_job_countinsrc/api/session.rs.issue2859_*insrc/api/consumer_tests.rs):one/two Running, reaped (+ repeated reads, no flicker), disowned,
Stopped (+ CONT back to Running), procsub child never counts.
The host adoption (niu prompt segment reading through this face
instead of
NIU_BACKGROUND_JOBS) follows in a niubash PR.Verification (lane): pins 6/6; full lib branch 1136/0/3 vs base
1130/0/3;
session_apistem 19/19; ledger checker 281/281 +self-test +
--niurc=0.本 PR 删除了什么
Nothing. Pure addition (+170 lines): the new face, its pins, and its
ledger rows. No function, file, or behavior removed;
JobCandidatedeliberately untouched.
Net: +170/−0 across 4 files.
Refs #863, rubash#2859.