Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/lint_build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: |
if [ -f go.work ]; then
echo "Building with go.work..."
go build ./...
go build all
Comment on lines 49 to +51

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

In Go workspace mode (go.work), what does go build allbuild compared togo build ./...?

💡 Result:

In Go workspace mode (go.work), go build all builds the package pattern named by the import-path pattern all (not “all packages”). If you have no package import path matching all (which is usually the case), it will fail with “no packages to build”. By contrast, go build ./... builds every package under the current directory (recursively), i.e., it expands the ./... package pattern to all matching packages and compiles them (and their dependencies). So, they are not equivalent: ./... is a recursive filesystem-based package pattern, while all is just a literal package-pattern token; workspace mode (go.work) affects how the module set is selected for the build, but it does not make all become “all packages”. [1][2][3]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
ls -la .github/workflows || true
sed -n '1,120p' .github/workflows/lint_build_docs.yml | nl -ba | sed -n '35,90p'

Repository: fallofpheonix/PheonixOS

Length of output: 497


🏁 Script executed:

#!/bin/bash
set -euo pipefail
cat -n .github/workflows/lint_build_docs.yml | sed -n '1,160p'

Repository: fallofpheonix/PheonixOS

Length of output: 2446


🏁 Script executed:

#!/bin/bash
set -euo pipefail
ls -la go.work || true
[ -f go.work ] && cat -n go.work
echo "---- dirs named all ----"
find . -type d -name all -print | head -n 20
echo "---- any module/package named all (import paths) ----"
rg -n --hidden --no-ignore -S "(/|^)all(/|$)" -g'*.go' . || true

Repository: fallofpheonix/PheonixOS

Length of output: 780


Fix Go workspace build command in CI (go build all)

In the go.work branch of .github/workflows/lint_build_docs.yml, go build all builds the package pattern named all (not “all packages”). This repo doesn’t contain a module/package matching all, so the workflow won’t build the intended set of workspace packages. Use go build ./... instead.

🔧 Proposed fix
           if [ -f go.work ]; then
             echo "Building with go.work..."
-            go build all
+            go build ./...
           else
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/lint_build_docs.yml around lines 49 - 51, In the if-branch
that checks for a Go workspace file (the block starting with the shell
conditional "if [ -f go.work ]; then"), replace the incorrect build invocation
"go build all" with the recursive package pattern "go build ./..." so the CI
builds all workspace packages rather than trying to build a package literally
named "all".

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore workspace build scope to local packages

Using go build all in the build-go job broadens CI from building this repo’s packages to also building every dependency (including test-only deps) of every workspace module, which makes the pipeline fail on upstream/transitive breakage unrelated to this PR and increases build instability. go help packages defines all that way, so this change materially alters CI semantics versus ./... and can block merges when a dependency’s build regresses.

Useful? React with 👍 / 👎.

else
echo "Building individual modules..."
modules=(
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/telemetry_gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
Comment on lines 13 to +15

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Set persist-credentials: false on the LFS-enabled checkout.

Per the zizmor artipacked hint, actions/checkout leaves the .git/config with a base64-encoded GitHub token by default. With lfs: true, an .lfsconfig/credential helper can persist similarly. Since later steps (upload-artifact) publish files derived from the workspace, explicitly disabling credential persistence reduces the risk of inadvertently exfiltrating the repo token via artifacts.

🛡️ Proposed fix
       - uses: actions/checkout@v4
         with:
           lfs: true
+          persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v4
with:
lfs: true
- uses: actions/checkout@v4
with:
lfs: true
persist-credentials: false
🧰 Tools
🪛 zizmor (1.25.2)

[warning] 13-15: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 13-13: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/telemetry_gate.yml around lines 13 - 15, The checkout step
currently enables LFS via actions/checkout@v4 with "lfs: true" but does not
disable credential persistence; update the checkout invocation to include
persist-credentials: false so the GitHub token (and any LFS credential helper)
is not written into .git/config or persisted into the workspace — modify the
actions/checkout usage in the workflow to add persist-credentials: false
alongside lfs: true.


- name: Set up Go
uses: actions/setup-go@v4
Expand Down
36 changes: 36 additions & 0 deletions agents/internal/physics/kalman.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package physics

// KalmanFilter implements a simple 1D Kalman filter for anomaly detection
type KalmanFilter struct {
Q float64 // process noise covariance
R float64 // measurement noise covariance
P float64 // estimation error covariance
X float64 // value
K float64 // kalman gain
}

func NewKalmanFilter(q, r, p, initialValue float64) *KalmanFilter {
return &KalmanFilter{
Q: q,
R: r,
P: p,
X: initialValue,
}
}

func (kf *KalmanFilter) Update(measurement float64) float64 {
// Prediction update
// X = X
// P = P + Q
kf.P = kf.P + kf.Q

// Measurement update
// K = P / (P + R)
kf.K = kf.P / (kf.P + kf.R)
// X = X + K * (measurement - X)
kf.X = kf.X + kf.K*(measurement-kf.X)
// P = (1 - K) * P
kf.P = (1 - kf.K) * kf.P

return kf.X
}
Comment on lines +21 to +36

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Guard against division-by-zero / non-finite gain.

kf.K = kf.P / (kf.P + kf.R) divides by kf.P + kf.R. With the current physics.go init (R=1.0, P=1.0) this is safe, but KalmanFilter is an exported type with no constructor validation; any caller passing R=0 together with a P that decays to ~0 (or supplying P=R=0) will produce NaN/±Inf and silently corrupt kf.X, which then flows into a.threatTemp and the IsAnomaly decision in GetSecurityState.

🛡️ Proposed guard
 func (kf *KalmanFilter) Update(measurement float64) float64 {
 	// Prediction update
 	// X = X
 	// P = P + Q
 	kf.P = kf.P + kf.Q
 
 	// Measurement update
-	// K = P / (P + R)
-	kf.K = kf.P / (kf.P + kf.R)
+	// K = P / (P + R)
+	denom := kf.P + kf.R
+	if denom <= 0 {
+		// Degenerate covariance; skip measurement update to avoid NaN/Inf.
+		return kf.X
+	}
+	kf.K = kf.P / denom
 	// X = X + K * (measurement - X)
 	kf.X = kf.X + kf.K*(measurement-kf.X)
 	// P = (1 - K) * P
 	kf.P = (1 - kf.K) * kf.P
 
 	return kf.X
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func (kf *KalmanFilter) Update(measurement float64) float64 {
// Prediction update
// X = X
// P = P + Q
kf.P = kf.P + kf.Q
// Measurement update
// K = P / (P + R)
kf.K = kf.P / (kf.P + kf.R)
// X = X + K * (measurement - X)
kf.X = kf.X + kf.K*(measurement-kf.X)
// P = (1 - K) * P
kf.P = (1 - kf.K) * kf.P
return kf.X
}
func (kf *KalmanFilter) Update(measurement float64) float64 {
// Prediction update
// X = X
// P = P + Q
kf.P = kf.P + kf.Q
// Measurement update
// K = P / (P + R)
denom := kf.P + kf.R
if denom <= 0 {
// Degenerate covariance; skip measurement update to avoid NaN/Inf.
return kf.X
}
kf.K = kf.P / denom
// X = X + K * (measurement - X)
kf.X = kf.X + kf.K*(measurement-kf.X)
// P = (1 - K) * P
kf.P = (1 - kf.K) * kf.P
return kf.X
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agents/internal/physics/kalman.go` around lines 21 - 36, The Update method
can produce NaN/Inf when computing kf.K = kf.P / (kf.P + kf.R); guard by
computing denom := kf.P + kf.R and if denom is zero or not finite (use
math.IsNaN / math.IsInf) set kf.K = 0 (or clamp to a safe value) and skip the
measurement update that would corrupt kf.X; after computing kf.K also validate
it with math.IsNaN/math.IsInf and if invalid set kf.K = 0 and ensure kf.P
remains non-negative (clamp if needed) so the filter never writes NaN/Inf into
kf.X or kf.P.

8 changes: 5 additions & 3 deletions agents/internal/physics/physics.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ type Agent struct {
lastEntropy float64
lastSDI float64
threatTemp float64
tempFilter *KalmanFilter
}

func NewPhysicsAgent() *Agent {
return &Agent{
threatTemp: 0.1, // baseline normal temp
tempFilter: NewKalmanFilter(0.1, 1.0, 1.0, 0.1),
}
}

Expand Down Expand Up @@ -87,11 +89,11 @@ func (a *Agent) GetSecurityState(graph *types.IncidentGraph, now time.Time) (typ
if targetTemp > 10.0 {
targetTemp = 10.0
}
// Simple thermal inertia (smoothing)
a.threatTemp = a.threatTemp*0.7 + targetTemp*0.3

// Apply Kalman filter to smooth and predict threat temperature
a.threatTemp = a.tempFilter.Update(targetTemp)

// Retrieve Shannon entropy from monitor package
// We'll compute it from mock bytes for this state check or use a default
testData := make([]byte, 256)
if maxThreat >= 7.0 {
// High disorder data
Expand Down
1 change: 1 addition & 0 deletions go.work
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use (
./14_experiments/telemetry_replay
./agents
./custom/control_plane
./phoenix_os/agents/internal/security
./phoenix_os/arbiter
./phoenix_os/bus
./phoenix_os/common
Expand Down
5 changes: 5 additions & 0 deletions phoenix_os/agents/internal/security/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module phoenix/agents/internal/security

go 1.25.0

replace phoenix/security => ../../../07_security

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Correct replace path to 07_security module

The local replacement path in phoenix_os/agents/internal/security/go.mod is off by one directory level: from this module, ../../../07_security resolves to phoenix_os/07_security, which does not exist in the repo. As soon as this module (or tooling like go mod tidy) needs to resolve phoenix/security, Go will fail with a missing replacement directory error, blocking builds for consumers of this module.

Useful? React with 👍 / 👎.

30 changes: 30 additions & 0 deletions phoenix_os/agents/internal/security/reputation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package security

import "sync"

// ReputationManager tracks the trustworthiness of nodes in the swarm.
type ReputationManager struct {
mu sync.RWMutex
Reputation map[string]float64
Comment on lines +6 to +8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Expose the map only via methods to avoid unsynchronized access

Because Reputation is exported, callers can bypass the mutex and access the map directly, violating the locking assumptions in Deduct/GetScore and causing data races. Make the field unexported (e.g. reputation map[string]float64) and expose any needed operations via methods that always take the lock.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make reputation storage private to preserve thread safety

The Reputation map is exported, so callers can mutate it without taking rm.mu; this bypasses the lock discipline used by Deduct/GetScore and can trigger data races or concurrent map read and map write panics under concurrent access. Because this manager is explicitly synchronized, exposing raw mutable state defeats the concurrency guarantees and should be replaced with private storage plus setter/getter methods.

Useful? React with 👍 / 👎.

}
Comment on lines +7 to +9

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Exported Reputation map bypasses your mutex protection.

Line 8 exposes mutable shared state, so callers can write rm.Reputation[...] without mu, creating races and invalidating the thread-safety contract in Lines 19-23.

Suggested refactor
 type ReputationManager struct {
-	mu         sync.RWMutex
-	Reputation map[string]float64
+	mu         sync.RWMutex
+	reputation map[string]float64
 }

 func NewReputationManager() *ReputationManager {
 	return &ReputationManager{
-		Reputation: make(map[string]float64),
+		reputation: make(map[string]float64),
 	}
 }

 func (rm *ReputationManager) Deduct(nodeID string, amount float64) {
 	rm.mu.Lock()
 	defer rm.mu.Unlock()
-	rm.Reputation[nodeID] -= amount
+	rm.reputation[nodeID] -= amount
 }

 func (rm *ReputationManager) GetScore(nodeID string) float64 {
 	rm.mu.RLock()
 	defer rm.mu.RUnlock()
-	return rm.Reputation[nodeID]
+	return rm.reputation[nodeID]
 }

Also applies to: 19-23

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@phoenix_os/agents/internal/security/reputation.go` around lines 7 - 9, The
exported Reputation map allows callers to mutate shared state without acquiring
the mu lock; make the map unexported (rename to reputation) and replace direct
accesses with concurrency-safe accessor/mutator functions that use mu (e.g.,
GetReputation(key) float64, SetReputation(key, value), and/or
SnapshotReputations() map[string]float64) and update any callers to use those
methods instead of touching Reputation directly; ensure all reads use
mu.RLock/RUnlock and all writes use mu.Lock/Unlock to preserve the thread-safety
guarantees in the existing methods that reference mu.


// NewReputationManager initializes with default scores.
func NewReputationManager() *ReputationManager {
return &ReputationManager{
Reputation: make(map[string]float64),
}
}

// Deduct reduces a node's reputation score for suspicious behavior.
func (rm *ReputationManager) Deduct(nodeID string, amount float64) {
rm.mu.Lock()
defer rm.mu.Unlock()
rm.Reputation[nodeID] -= amount

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject negative deductions in reputation updates

Deduct is documented to reduce reputation, but passing a negative amount currently increases the score because of -=. If amount comes from noisy telemetry or an unchecked caller, suspicious events can accidentally (or intentionally) boost reputation, which inverts the security signal this component is meant to enforce.

Useful? React with 👍 / 👎.

}
Comment on lines +19 to +23

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Reputation actions are not recorded in Phoenix Ledger.

Line 22 mutates reputation with no evidence record or hash-chain update, so this misses the required audit trail.

As per coding guidelines, Every action MUST be recorded in the Phoenix Ledger with a SHA-256 hash-chain for evidence-first actuation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@phoenix_os/agents/internal/security/reputation.go` around lines 19 - 23,
Reputation deduction in ReputationManager.Deduct mutates rm.Reputation without
recording the action to the Phoenix Ledger or updating the SHA-256 hash-chain;
change Deduct to build an evidence record (include nodeID, amount, pre- and
post-reputation values, timestamp, and actor), compute its SHA-256 hash, append
the record/hash to the Phoenix Ledger via the project's ledger API (e.g.,
Ledger.Append/Record or PhoenixLedger.RecordAction), and only then apply
rm.Reputation[nodeID] -= amount while holding rm.mu so the ledger entry reflects
the exact state transition and advances the hash-chain.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reject negative deduction amounts.

At Line 22, passing a negative amount increases a node’s score, which breaks deduction semantics and can be abused.

Suggested fix
 func (rm *ReputationManager) Deduct(nodeID string, amount float64) {
+	if amount < 0 {
+		return // or panic/error depending on your error model
+	}
 	rm.mu.Lock()
 	defer rm.mu.Unlock()
 	rm.Reputation[nodeID] -= amount
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func (rm *ReputationManager) Deduct(nodeID string, amount float64) {
rm.mu.Lock()
defer rm.mu.Unlock()
rm.Reputation[nodeID] -= amount
}
func (rm *ReputationManager) Deduct(nodeID string, amount float64) {
if amount < 0 {
return // or panic/error depending on your error model
}
rm.mu.Lock()
defer rm.mu.Unlock()
rm.Reputation[nodeID] -= amount
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@phoenix_os/agents/internal/security/reputation.go` around lines 19 - 23, The
Deduct method currently allows negative amounts which will increase a node's
reputation; add an input guard in ReputationManager.Deduct to reject negative
deduction values (e.g., if amount < 0 { return } or return an error) before
acquiring or modifying rm.Reputation, so only positive amounts decrease
rm.Reputation[nodeID]; reference the Deduct method and the rm.Reputation map
when making the change.


// GetScore returns the current reputation of a node.
func (rm *ReputationManager) GetScore(nodeID string) float64 {
rm.mu.RLock()
defer rm.mu.RUnlock()
return rm.Reputation[nodeID]
}
14 changes: 14 additions & 0 deletions phoenix_os/agents/internal/security/reputation_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package security

import "testing"

func TestReputationDeduction(t *testing.T) {
rm := NewReputationManager()
rm.Reputation["node-1"] = 1.0

rm.Deduct("node-1", 0.2)
score := rm.GetScore("node-1")
if score != 0.8 {
t.Errorf("Expected 0.8, got %f", score)
}
Comment on lines +11 to +13

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use tolerant float comparison in the assertion.

Line 11 uses exact float equality, which is brittle for decimal arithmetic.

Suggested fix
 import "testing"
+import "math"
@@
-	if score != 0.8 {
+	if math.Abs(score-0.8) > 1e-9 {
 		t.Errorf("Expected 0.8, got %f", score)
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@phoenix_os/agents/internal/security/reputation_test.go` around lines 11 - 13,
The test currently checks exact equality on the float variable score (if score
!= 0.8), which is brittle; change it to a tolerant comparison using a small
epsilon (e.g., math.Abs(score - 0.8) > eps) and fail the test only when the
difference exceeds eps, importing math and keeping the t.Errorf to show expected
and actual values (and optionally the difference) so the assertion tolerates
floating-point rounding.

}
Comment on lines +5 to +14

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Required adversarial validation is missing from tests.

This test only checks a single happy-path deduction. Issue #143 explicitly requires simulated adversarial runs to validate detection + reputation deduction behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@phoenix_os/agents/internal/security/reputation_test.go` around lines 5 - 14,
The test TestReputationDeduction currently only verifies a single happy-path
deduction; update it to include simulated adversarial runs that exercise
detection and reputation decay logic: create multiple nodes via
NewReputationManager (e.g., "node-1" through "node-N"), simulate repeated
malicious actions by calling Deduct on the offending node(s) and benign actions
on others, then assert via GetScore that malicious nodes drop below detection
thresholds and benign nodes remain above them, and also validate any automated
detection hooks or callbacks your ReputationManager exposes (e.g.,
Detected/Mitigated events or methods) to ensure the detection + deduction flow
behaves as expected under adversarial pressure.

34 changes: 34 additions & 0 deletions tools/create_adhoc_issues.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import subprocess
import time

issues = [
("[LABS] [L0] Implement Foundations Labs", "Implement labs 00-08 defined in 01_research/stage_00_foundations/labs/phase_00_implementation_labs.md.\n\nTasks:\n- Lab 00: Number systems\n- Lab 01: Memory model\n- Lab 02: Sequential data structures\n- Lab 08: Problem-solving", "enhancement,needs-triage"),
("[LABS] [L0] Implement Architecture Labs", "Implement labs defined in 01_research/stage_00_foundations/labs/phase_01_architecture_labs.md.\n\nTasks:\n- Assembly calling convention\n- Cache locality benchmark\n- False sharing analysis", "enhancement,needs-triage"),
("[LABS] [L0] Implement Programming Labs", "Implement labs defined in 01_research/stage_00_foundations/labs/phase_02_low_level_programming_labs.md.\n\nTasks:\n- Heap allocator\n- ELF parser\n- Mini shell", "enhancement,needs-triage"),
("[LABS] [L1] Implement OS Internals Labs", "Implement labs defined in 01_research/stage_01_system_internals/labs/phase_03_operating_systems_labs.md.\n\nTasks:\n- Process lifecycle\n- Scheduler\n- VFS", "enhancement,needs-triage"),
("[LABS] [L2] Implement Linux Internals Labs", "Implement labs defined in 01_research/stage_02_linux_and_distros/labs/phase_04_linux_internals_labs.md.\n\nTasks:\n- Kernel build\n- Kernel module\n- Namespaces/cgroups", "enhancement,needs-triage"),
("[LABS] [L3] Implement Networking Labs", "Implement labs defined in 01_research/stage_03_networking/labs/phase_05_networking_labs.md.\n\nTasks:\n- OSI/Encapsulation\n- DNS\n- TCP\n- Packet dissection", "enhancement,needs-triage"),
("[SURFACE] Refactor Orchestrator State Handling", "The file agents/surface/orchestrator/service.py contains TODOs related to label management ('surface:todo').\n\nTasks:\n- Refactor state-to-label mapping.\n- Replace hardcoded TODO labels.", "bug,needs-triage"),
("[L0] Foundations: Establish Problem-solving Lab Set", "Per 01_research/stage_00_foundations/labs/phase_00_implementation_labs.md, the Problem-solving lab (Lab 08) needs definition.\n\nTasks:\n- Define the lab requirements for the problem-solving set.", "research,needs-triage"),
("[L1] Architecture: Document NUMA Topology Reasoning", "Document topology and locality rationale for PhoenixOS (01_research/stage_00_foundations/labs/phase_01_architecture_labs.md).", "documentation,needs-triage"),
("[L1] Low-Level Programming: Formalize Rust Syscall Wrapper", "Design safe syscall abstraction layer for Rust (01_research/stage_00_foundations/labs/phase_02_low_level_programming_labs.md).", "enhancement,needs-triage"),
("[L2] OS Internals: Modify xv6 for PhoenixOS", "Plan modifications for syscalls, scheduler, and file operations in xv6 (01_research/stage_01_system_internals/labs/phase_03_operating_systems_labs.md).", "research,needs-triage"),
("[L3] Networking: Implement Packet Dissection Parser", "Implement hex parsing for raw packets (01_research/stage_03_networking/labs/phase_05_networking_labs.md).", "enhancement,needs-triage"),
("[SURFACE] Orchestrator: Update Label Management", "Update labels from 'surface:todo' to canonical triage labels in agents/surface/orchestrator/service.py.", "bug,needs-triage"),
("[LABS] [L2] cgroups: Investigate v1 vs v2 differences", "Analyze differences between cgroup v1 and v2 (01_research/stage_02_linux_and_distros/labs/phase_04_linux_internals_labs.md).", "research,needs-triage"),
("[LABS] [L3] Networking: Security Analysis of DNS Exfiltration", "Perform security analysis on plaintext DNS vs. DoH (01_research/stage_03_networking/labs/phase_05_networking_labs.md).", "security,needs-triage")
]

for title, body, label in issues:
cmd = [
"gh", "issue", "create",
"--title", title,
"--body", body + "\n\n> *This was generated by AI during triage.*",
"--label", label
]
try:
subprocess.run(cmd, check=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (python.lang.security.audit.dangerous-subprocess-use-audit): Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'.

Source: opengrep

print(f"Created: {title}")
time.sleep(1)
except Exception as e:
print(f"Failed: {title} - {e}")
35 changes: 35 additions & 0 deletions tools/create_final_issues.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import subprocess
import time

issues = [
{"title": "[RESEARCH] [L6] Dynamics: State-Space Trajectory Drift", "body": "Investigate embedding state-space analysis in 06_ai/dynamics to detect trajectory drift (R025).", "label": "enhancement,needs-triage"},
{"title": "[INTELLIGENCE] [L5.5] Arbiter: VCG Mechanism Design", "body": "Design and implement VCG mechanisms for game-theoretic resource allocation (R030).", "label": "enhancement,needs-triage"},
{"title": "[INTELLIGENCE] [L5.5] Arbiter: Strong Stackelberg Equilibrium", "body": "Implement efficient SSE calculation for defender/attacker game dynamics (R028).", "label": "enhancement,needs-triage"},
{"title": "[TESTING] GraphAgent: Validate DAG Scaling Limit", "body": "Stress test 09_telemetry/process_graphs with >100k nodes to validate 3-tier storage performance.", "label": "enhancement,needs-triage"},
{"title": "[L1] Guard Runtime: eBPF Syscall Filtering Enhancement", "body": "Enhance eBPF filters in 10_kernel/guard to detect complex multi-syscall attack patterns.", "label": "enhancement,needs-triage"},
{"title": "[L3] Telemetry: Optimize Event Serialization", "body": "Benchmark and optimize JSON serialization in 09_telemetry/pipelines for 200k events/sec.", "label": "enhancement,needs-triage"},
{"title": "[DOCS] Theory: Document Game-Theoretic Policy Stability", "body": "Create formal documentation for action debt and cooldown timers in the Game Theory layer.", "label": "enhancement,needs-triage"},
{"title": "[INTEGRATION] Arbiter: Reputation-Weighted Quorum Implementation", "body": "Integrate reputation scores from P2P nodes into the Byzantine-Resistant consensus mechanism.", "label": "enhancement,needs-triage"},
{"title": "[TOOLS] Reverse Engineering: YARA Rule Automation", "body": "Automate YARA rule deployment to the security distribution layer (07_security/yara).", "label": "enhancement,needs-triage"},
{"title": "[L2] Kernel Scheduler: Prototype Game-Aware Scheduling", "body": "Prototype a kernel-level scheduler policy that prioritizes processes based on Arbiter importance scores.", "label": "enhancement,needs-triage"},
{"title": "[L3] Physics: Validate Thermal Inertia Smoothing", "body": "Verify the 0.7 thermal inertia smoothing constant against highly volatile attack workloads (R024).", "label": "enhancement,needs-triage"},
{"title": "[L3] Telemetry: Implement Wavelet-based Noise Reduction", "body": "Implement wavelet transform filters in 09_telemetry/math_filters for telemetry pre-processing.", "label": "enhancement,needs-triage"},
{"title": "[L6] Forensics: Implement Automated Hash Chain Auditing", "body": "Create automated audit tool that validates the hash-chain integrity of all Forensic snapshots in 08_forensics.", "label": "enhancement,needs-triage"},
{"title": "[INTEGRATION] Infrastructure: Formalize Observability Pipeline", "body": "Formalize the pipeline between 12_infrastructure/observability and 09_telemetry/telemetry_agent.", "label": "enhancement,needs-triage"},
{"title": "[L0] Foundations: Implement Bit Manipulation Lab", "body": "Implement Lab 00 (Number systems and bit operations) from 01_research/stage_00_foundations/labs/phase_00_implementation_labs.md.", "label": "enhancement,needs-triage"}
]

for issue in issues:
body_content = issue["body"] + "\n\n> *This was generated by AI during triage.*"
cmd = [
"gh", "issue", "create",
"--title", issue["title"],
"--body", body_content,
"--label", issue["label"]
]
try:
subprocess.run(cmd, check=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (python.lang.security.audit.dangerous-subprocess-use-audit): Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'.

Source: opengrep

print(f"Created: {issue['title']}")
time.sleep(1)
except Exception as e:
print(f"Failed: {issue['title']} - {e}")
1 change: 1 addition & 0 deletions tools/guard_runtime_py/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Simple CLI for prototype guard runtime."""
import argparse
import os
from guard_runtime.daemon import GuardDaemon
import json
import socket
Expand Down
Loading