Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
3edf55f
build: bump rust toolchain version to 2026-01-09
greatbridf Oct 24, 2026
e49012a
target: update x86 json to support new rust nightly
greatbridf Jan 25, 2026
5071f12
loongarch64, interrupt: implement external interrupt delivery
greatbridf Oct 26, 2026
2202f18
script: refactor the build image script
greatbridf Jan 24, 2026
2e20ee7
test: rework test script and github workflow
greatbridf Jan 24, 2026
e387f7e
ci: install expect and update printf usage
greatbridf Jan 24, 2026
dc8dc98
script, build-img: add script folder for each platforms
greatbridf Jan 24, 2026
8389367
style, hal: rename x86 trap.rs to trap/mod.rs
greatbridf Jan 24, 2026
f870a56
chore: remove the specific target from config.toml
greatbridf Jan 25, 2026
2779cf8
chore: remove and ignore vscode settings from svc
greatbridf Jan 18, 2026
916354b
agents: add fix-and-pr workflow as a skill
greatbridf Oct 19, 2026
d6916ba
script: add a script to help translate stacktraces
greatbridf Jan 17, 2026
675c9f1
vfs: rework the vfs subsystem with async
greatbridf Sep 2, 2025
572333f
vfs, rcu: rework path walking with new rcu syntax
greatbridf Sep 14, 2025
6c6e9f1
style, vfs: remove unused imports and InodeRef
greatbridf Sep 14, 2025
c3db2d5
vfs: fix debug print of `Mode` structs
greatbridf Sep 14, 2025
9d270c7
style: change import style and reformat codes
greatbridf Oct 26, 2026
7768373
mem, paging: introduce page locks and exclusive pages
greatbridf Oct 8, 2025
df7c730
tls: rework of arch's UserTLS design
greatbridf Dec 22, 2025
0381143
mem, slab: rework the slab system
greatbridf Jan 6, 2026
7792a5e
mem, buddy: rework the buddy system
greatbridf Jan 6, 2026
ef42bc6
vfs: rework of inode and page cache system
greatbridf Jan 13, 2026
9674575
mem: introduce new `Folio` abstraction
greatbridf Jan 17, 2026
6bdab59
style: fix or suppress warnings
greatbridf Jan 17, 2026
e0cb58d
user, init: update riscv64 init script
greatbridf Jan 17, 2026
fed6f4a
mm, proc: add an exited thread reaper
greatbridf Jan 18, 2026
96803aa
proc: rewrite process list organization
greatbridf Jan 20, 2026
2c1038e
style: reformat the files related to next patches
greatbridf Jan 23, 2026
3796965
riscv64, hal: simplify ArchMemory::free_ram implementation
greatbridf Jan 23, 2026
fe45e19
style: add helper macros to retrieve symbol constants
greatbridf Jan 23, 2026
74156da
style: reformat files
greatbridf Jan 23, 2026
77176c2
riscv64, linker: make sure vdso lies inside .data
greatbridf Jan 23, 2026
89f277c
riscv64: rewrite FDT and present free memory parsing
greatbridf Jan 23, 2026
1b69f51
sysinit: pointee type should be u8 when using ptr::write_bytes
greatbridf Jan 23, 2026
22c4ed3
style: reformat file
greatbridf Jan 23, 2026
ddfb527
hal, mm: alloc basic folios from low to high addr
greatbridf Jan 23, 2026
194624a
feat: add kernel config framework, rework panicking
greatbridf Jan 26, 2026
9e1a776
style: reformat files
greatbridf Jan 26, 2026
3c8a775
signal: remove await on thread.force_kill in x86 sigreturn
greatbridf Jan 26, 2026
4aba701
style: extract common import out in vdso rt_sigreturn
greatbridf Jan 26, 2026
7f07b78
style: reformat x86 bootstrap code
greatbridf Jan 26, 2026
cd95937
x86, hal: support loading kernel image up to 14M
greatbridf Jan 26, 2026
7ae60df
kernel: put kernel shutdown into `power` module
greatbridf Jan 26, 2026
1acdf5c
x86: add shutdown support
greatbridf Jan 26, 2026
1ccbdf9
x86: export symbols needed by vdso
greatbridf Jan 26, 2026
6204f19
x86, TLS: adapt for the new TLS design
greatbridf Jan 26, 2026
cd2e9db
hal, x86: add cpu count global variable
greatbridf Jan 26, 2026
3aada0e
hal, x86: support the new folio abstraction
greatbridf Jan 26, 2026
593b871
hal, x86: use a new trap handling method
greatbridf Jan 26, 2026
5b665ac
runtime: remove unused ExecutionContext and Stack
greatbridf Jan 27, 2026
7833d53
hal: remove dependency of TaskContext for TrapContext
greatbridf Jan 27, 2026
a51f68d
hal: remove struct TaskContext from riscv64
greatbridf Jan 27, 2026
63e8e99
hal: remove struct TaskContext for x86
greatbridf Jan 27, 2026
c36e6e8
hal: support breakpoint trap type
greatbridf Jan 28, 2026
a700ab8
hal: add a function to setup kernel call frames
greatbridf Jan 28, 2026
9ecb4e8
style: reformat thread.rs
greatbridf Jan 28, 2026
f95c05f
hal: set int state and user mode in TrapContext::new
greatbridf Jan 28, 2026
731798d
pipeline: remove loongarch64 and add x86 build and test
greatbridf Jan 28, 2026
3886a50
style: reformat mm_area.rs and mm_list.rs
greatbridf Feb 11, 2026
a301905
style, mem: move mod mm_area into mm_list
greatbridf Feb 11, 2026
faf26a4
style: reformat page_fault.rs
greatbridf Feb 13, 2026
b401a07
mem: use intrusive lists for `MemArea`s
greatbridf Feb 13, 2026
6db1379
mem: add a function to insert Arc<MemArea>s into the list
greatbridf Feb 20, 2026
c4babca
style: reformat interrupt.rs
greatbridf Feb 20, 2026
ad2e978
fix/interrupt: use lock_irq in default_irq_handler
greatbridf Feb 20, 2026
6e42a53
mem: move brk related codes to brk.rs
greatbridf Feb 20, 2026
9dcf0f7
mem: remove unused `AreaList::get_or_insert()`
greatbridf Feb 23, 2026
ca5004d
mem: protect `MemArea::grow()` with AreaList lock
greatbridf Feb 23, 2026
49adef5
mem: use a ZST MemListLock to avoid using &MMListInner
greatbridf Feb 23, 2026
3a1045d
mem: protect `MemArea::clone()` with MMList's lock
greatbridf Feb 23, 2026
099078d
mem: unify the two kind of range read locks
greatbridf Feb 23, 2026
37b8f24
mem: introduce per MemArea lock
greatbridf Feb 25, 2026
af3b7de
mem: add a lock field in AreaList
greatbridf Feb 26, 2026
55bc174
WIP: mem: add a helper to isolate mem areas
greatbridf Feb 27, 2026
ff86b2d
WIP: mem: wrap and force the Future returned to be Send
greatbridf Feb 27, 2026
35fdc5e
WIP: mem: provide multi-usage link struct
greatbridf Feb 27, 2026
3cad121
WIP: mem: reimpl `MMList::unmap` using `isolate()`
greatbridf Feb 27, 2026
8fc3fbb
mem: make MemArea flags atomic
greatbridf Feb 28, 2026
eedeef3
WIP: mem: reimpl `MMList::protect` using `isolate()`
greatbridf Feb 28, 2026
5c4257e
WIP: mem: remove unused MemArea member functions
greatbridf Feb 28, 2026
75e87c8
style: reformat chardev.rs dentry.rs vfs/file/mod.rs
greatbridf Mar 1, 2026
6d05a0f
chardev: make `CharDevice::read()` async
greatbridf Mar 1, 2026
594b358
hal, x86_64: increase global CPU_COUNT in setup_cpu
greatbridf Mar 2, 2026
5a18973
style: reformat rcu.rs
greatbridf Mar 2, 2026
10eb2c4
sync, rcu: reuse `RCUReadGuardNew` for `RCUReadGuard`
greatbridf Mar 2, 2026
89d1b5f
style: reformat clone.rs
greatbridf Mar 2, 2026
783a2ff
task: don't hold thread.inner spinlock for too long
greatbridf Mar 2, 2026
be57074
task: clone the parent thread's TLS if not given
greatbridf Mar 2, 2026
b7ddbea
kernel: introduce a late init mechanism
greatbridf Mar 4, 2026
8a0dfcd
kernel: support async functions for late init
greatbridf Mar 5, 2026
f14c16e
style: reformat mount.rs
greatbridf Mar 5, 2026
11d6d56
style: reformat procfs.rs
greatbridf Mar 5, 2026
5fe394c
vfs: move /proc/mounts population to mount.rs
greatbridf Mar 5, 2026
38c2011
style: reformat e1000e.rs
greatbridf Mar 5, 2026
88ec962
util: remove dont_check macro
greatbridf Mar 5, 2026
f018487
style: clean old kernel console log macros
greatbridf Mar 5, 2026
3a0ad14
style: reformat ahci/mod.rs
greatbridf Mar 5, 2026
710d9a0
style: remove println_warn from prelude
greatbridf Mar 5, 2026
62f72a6
style: reformat io.rs
greatbridf Mar 5, 2026
96c15ee
util: add buf_writeln helper macro
greatbridf Mar 5, 2026
5f594f3
style: reformat slab_allocator/lib.rs
greatbridf Mar 5, 2026
2e2f57b
slab: count alloced and total {slab, object}
greatbridf Mar 5, 2026
5ae4a08
slab: support printing slab debug info
greatbridf Mar 5, 2026
97acc83
style: reformat buddy_allocator/lib.rs
greatbridf Mar 5, 2026
cac3435
mem, buddy: count alloced pages
greatbridf Mar 5, 2026
831cba5
runtime: reformat scheduler.rs
greatbridf Mar 7, 2026
65531a9
runtime: release finished Task to avoid memory leaks
greatbridf Mar 7, 2026
96f8a30
style: reformat process.rs
greatbridf Mar 7, 2026
f3525ae
task, process: remove thread from its list when removing process
greatbridf Mar 7, 2026
44ea72a
util: embed the import of trait Buffer into buf_writeln
greatbridf Mar 7, 2026
1149777
util: add buf_write macro similar to buf_writeln
greatbridf Mar 7, 2026
1228689
buddy: count and print alloc and total info
greatbridf Mar 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 190 additions & 0 deletions .agents/skills/fix-and-pr/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
---
name: fix-and-pr
description: Reproduce, debug, fix, verify, and submit GBOS/Eonix kernel issues as pull requests. Use for kernel bug fixing, headless QEMU reproduction scripts, subagent-driven root-cause analysis, commit preparation, and credential-safe PR creation.
---

# GBOS / Eonix Fix and PR

## Mandatory credential gate

Run this before **any** other action: preflight, branch creation, issue
fetching, builds, analysis, or subagent launches.

1. Check `GH_TOKEN` without printing it:

```bash
test -n "${GH_TOKEN:-}"
```

2. If the check succeeds, continue.
3. If `GH_TOKEN` is unset or empty, stop immediately. Ask the user for a GitHub
token, preferably by exporting it:

```text
GH_TOKEN is not set. Please provide a GitHub token by exporting it in your
shell, for example:
export GH_TOKEN='...'
Tell me when it is set; I will not continue until then.
```

4. Do not run tools, inspect the repository, spawn subagents, or begin the
workflow until the user confirms it is available and the check succeeds.
5. Never echo, log, commit, or put `GH_TOKEN` in a subagent prompt. Do not
write it to a file.

The detailed protocol is split by phase under `references/`. Read
`references/README.md`, then `references/00-operating-contract.md`, then the
document for the current phase. Load only the documents needed for that phase.

If the task is not a GBOS/Eonix kernel issue, keep the same phase gates but
replace repository-specific paths, build commands, and remotes.

## When this skill applies

- A GitHub issue, bug report, stack trace, or failing test must be reproduced
and fixed.
- A QEMU-based kernel reproduction script is needed.
- The work needs subagent orchestration for analysis, implementation, review,
or PR publication.
- The user asks to prepare commits or open a PR for a verified fix.

## Entry point

```bash
ISSUE=<issue-id>
SLUG=<short-slug>
BASE=<base-branch>
ART="build/work/issue-${ISSUE}"
mkdir -p "$ART"
```

Then:

1. Confirm the credential gate above passes.
2. Read `references/README.md` and `references/00-operating-contract.md`.
3. Run the repository preflight in `references/01-environment-and-intake.md`.
4. Capture the issue in `$ART/issue.json`.
5. Follow the phase gates below in order, loading the matching reference
document when entering each phase.

## Phase gates

| Phase | Required evidence | Reference document |
| --- | --- | --- |
| 0. Intake and environment | `GH_TOKEN` present; clean checkout, configured toolchain, successful build, target QEMU boot, issue details captured. | [01 — Environment and issue intake](references/01-environment-and-intake.md) |
| 1. Reproduction | Headless script independently verified to distinguish bug from fixed behavior. | [02 — Automated reproduction](references/02-reproduction.md) |
| 2. Analysis | Root cause stated with evidence; fix boundary and invariants recorded. | [03 — Root-cause analysis](references/03-analysis.md) |
| 3. Fix and commits | Minimal scoped fix; clean, independently buildable commits with repository-style messages. | [04 — Fix planning and implementation](references/04-fix-and-commits.md), [05 — Commit conventions](references/05-commit-conventions.md) |
| 4. Verification and review | Baseline `--expect bug` passes, fixed `--expect fixed` passes, builds/tests pass, independent review has no blockers. | [06 — Verification and review](references/06-verification.md) |
| 5. PR | Correct base/head, pushed branch, PR body with verification evidence, local and PR diffs match, no secrets. | [07 — PR submission](references/07-pr-submission.md) |

Do not advance because a plausible fix exists. Advance only when the gate
evidence exists.

## Critical rules

1. **One writer per worktree.** Never run concurrent writers in the same
checkout.
2. **No reproduction, no fix.** Do not implement a speculative fix.
3. **No post-fix verification, no PR.** The same reproducer must pass in fixed
mode after the fix.
4. **Never use `git add -A` or `git add .`.** Add explicit paths only.
5. **Never leak `GH_TOKEN`.** Do not print it, pass it in prompts, write it to
disk, embed it in URLs, or commit it.
6. **Keep the fix minimal.** No unrelated refactors, formatting sweeps, or
dependency updates.
7. **Separate authoring from review.** Use a fresh-context `reviewer` for the
independent diff review.
8. **Stop on ambiguity.** Ask before changing unspecified behavior or choosing
a PR base branch.

## Reproduction contract

Save the script at:

```text
script/repro/issue-<id>-<slug>.exp
```

It must support:

```text
--expect bug|fixed
--arch <arch>
--mode <mode>
--smp <n>
--timeout <seconds>
--log <path>
--help
```

Exit codes:

| Code | Meaning |
| --- | --- |
| `0` | Observed behavior matched `--expect` |
| `1` | Observed behavior contradicted `--expect` |
| `2` | Infrastructure failure |
| `3` | Usage error |
| `130` | Interrupted |

Use `make test-run` for headless execution. Give QEMU a unique name and kill
only that instance; never use global `killall qemu-system-*`.

Before trusting the script, have a fresh verifier confirm:

- `--expect bug` exits 0 on the unmodified tree.
- `--expect fixed` exits 1 on the unmodified tree (negative control).
- No QEMU process remains after any exit path.
- Logs contain no secrets and are bounded.

## Supporting references

- [08 — Failure handling](references/08-failure-handling.md)
- [09 — Issue analysis template](references/09-analysis-template.md)
- [10 — Quick command reference](references/10-command-reference.md)
- [11 — Prompt hygiene](references/11-prompt-hygiene.md)

## Artifacts

Keep issue state outside chat history:

```text
build/work/issue-<id>/
├── issue.json
├── analysis.md
├── plan.md
├── script-review.md
├── before.log
├── after.log
└── pr.md
```

`build/` is ignored by Git, but `make clean` deletes it. Preserve important logs
elsewhere before a clean rebuild.

## Subagent roles

| Role | Use |
| --- | --- |
| `scout` | Read-only issue intake, code mapping, log analysis, hypothesis generation. |
| `worker` | One bounded implementation or script-generation task in one worktree. |
| `reviewer` | Fresh-context challenge of the reproduction script, root cause, plan, or final diff. |
| Publisher `worker` | Push the verified branch and create the PR; no code changes. |

The supervisor retains phase-gate decisions, final diff ownership, and
publication authority.

## Output expectations

When reporting progress or completion, include:

- Issue id and chosen base/head branches.
- Root cause and changed files.
- Baseline and fixed reproduction results with log paths.
- Build/test commands and exit codes.
- Independent review verdict.
- Commit hashes and PR URL, if created.
- Remaining risks or blockers.

READ ALL REFERENCE DOCUMENTATIONS UNDER THIS SKILL'S references/ DIRECTORY BEFORE CONTINUING!
121 changes: 121 additions & 0 deletions .agents/skills/fix-and-pr/references/00-operating-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# 00 — Operating contract

Part of the GBOS/Eonix `fix-and-pr` skill.

A standardized, end-to-end workflow for reproducing kernel issues, finding the
root cause, implementing and verifying a fix, and opening a pull request with
subagents.

The workflow is deliberately **evidence-gated**. Do not advance to the next
phase because a plausible fix exists; advance only when the previous phase has
produced verifiable evidence.

---

## 0. Operating contract

### 0.1 Roles

| Role | Owner | Responsibility |
| --- | --- | --- |
| Supervisor | Parent agent | Owns issue interpretation, phase gates, final diff, commits, and PR. Resolves ambiguity and approves publication. |
| Scout | `scout` subagent (read-only) | Fetches issue context, maps code paths, collects logs, proposes hypotheses. |
| Worker | `worker` subagent (writer) | Implements one bounded change in one worktree. |
| Reviewer | `reviewer` subagent (read-only, fresh context) | Independently challenges the reproduction script, diff, or root cause. |
| Verifier | `worker` or `reviewer` with a test-only mandate | Runs the reproduction and builds; does not edit kernel code. |
| Publisher | `worker` subagent | Pushes the branch and creates the PR. Does not change code. |

The supervisor may perform any step directly when that is cheaper than
delegation. Subagents are used to obtain isolation, independent verification,
and parallelism, not as ceremony.

### 0.2 Mandatory credential gate

Before any other workflow action, check `GH_TOKEN` without printing it:

```bash
test -n "${GH_TOKEN:-}"
```

- If it is set and non-empty, continue.
- If it is unset or empty, stop and ask the user for the token. Prefer asking
them to export it in their shell:

```text
GH_TOKEN is not set. Please provide a GitHub token by exporting it:
export GH_TOKEN='...'
Tell me when it is set; I will not continue until then.
```

- Do not inspect the repository, fetch issues, build, spawn subagents, or begin
any phase until the user confirms it is available and the check succeeds.
- Never echo, log, commit, or put `GH_TOKEN` in a prompt. Do not write it to a
file.

### 0.3 Non-negotiable rules

1. **One writer per worktree.** Never let two subagents edit the same checkout
concurrently.
2. **No fix without reproduction.** If the issue cannot be reproduced, record
why and stop; do not implement a speculative fix.
3. **No PR without post-fix verification.** The same reproduction that failed
before the fix must pass after it.
4. **Separate evidence from authority.** A subagent report is evidence. The
supervisor decides whether it is sufficient.
5. **Never leak credentials.** `GH_TOKEN` is read from the environment only.
Never print it, put it in a URL, a prompt, a commit, a log, or a file.
6. **Never use `git add -A` or `git add .`.** Explicitly add intended files;
otherwise an untracked secret or log can enter the commit.
7. **Minimal scope.** No unrelated refactors, formatting sweeps, or speculative
improvements in a bug-fix PR.
8. **Stop on ambiguity.** Ask before changing behavior that is not clearly
required by the issue, or when the target base branch is unclear.

### 0.4 Phase gates

| Phase | Gate to leave the phase |
| --- | --- |
| 0. Intake and environment | `GH_TOKEN` is present; repository builds, target architecture runs, issue details captured. |
| 1. Reproduction | A headless script exists and has been independently verified to distinguish bug from fixed behavior. |
| 2. Analysis | Root cause is stated with evidence; the fix boundary is identified. |
| 3. Fix and commits | Minimal fix is implemented; commits are clean and build independently. |
| 4. Verification and review | Reproduction passes in fixed mode, baseline passes in bug mode, builds/tests pass, independent review has no blocking findings. |
| 5. PR | Branch is pushed, PR is created with the correct base/head and verification evidence, and the local diff matches the PR diff. |

### 0.5 Persistent artifacts

Use issue-specific paths so later subagents can resume without relying on chat
history:

```bash
ISSUE=123
SLUG=short-issue-slug
ART="build/work/issue-${ISSUE}"
mkdir -p "$ART"
```

```text
build/work/issue-<id>/
├── issue.json # issue metadata and comments, if fetched
├── analysis.md # observations, hypotheses, root cause
├── plan.md # fix plan and test matrix
├── script-review.md # independent reproduction-script verdict
├── before.log # --expect bug run on the unmodified tree
├── after.log # --expect fixed run on the fixed tree
└── pr.md # final PR title/body and URL
```

Reproduction scripts belong in `script/repro/`, because they may be reused by
later subagents and optionally committed as regression tests:

```text
script/repro/issue-<id>-<slug>.exp
```

`build/` is ignored by Git, but `make clean` deletes it. Copy important logs
out before a clean rebuild, or keep the canonical logs in a temporary directory
such as `/tmp/gbos-issue-<id>/`.

---

Next: [01 — Environment and issue intake](01-environment-and-intake.md)
Loading
Loading