qvm: recover client inactivity policy and effects
Browse filesFiles changed (12)
- docs/FINDINGS.md+2
- docs/PROVISIONAL_TODO.md+2
- docs/RESEARCH_LEDGER.md+4
- docs/REVERSE_ENGINEERING_TODO.md+2
- docs/research/QVM_CLIENT_INACTIVITY.mdAdded+5
- docs/research/README.md+2
- docs/research/qvm-client-inactivity.jsonAdded
- scripts/analyze_qvm_client_inactivity.pyAdded+12
- scripts/qvm_client_processing_oracle.py+21
- scripts/qvm_client_processing_support.py+18
- scripts/test_qvm_client_inactivity.pyAdded+12
- xtask/checks.tsv+4
1886 unmodified lines1887188818891886 unmodified linesRE-976: Forty-eight source command-rewrite cases recover pause-mask1 and mode10/client-mask16 locking, saved-angle restore versus update, and independent server override. Clearing bytes493..495 preserves the low byte492 and command timestamp; buttons clear separately. Other pause bits alone do not trigger this lock. Native later movement execution remains outside this fragment. [Evidence](research/QVM_CLIENT_COMMAND_REWRITE.md).RE-977: Rust matches48 source command rewrites, retaining pause-mask1 selection, mode10/client-mask16 locking, saved-angle direction and independent server masking. The low adjacent command byte survives clearing movement bytes, and command time is not modified by this API. Unit tests cover non-locking pause bits, angle restore/save order and low-byte preservation. [Evidence](research/RUST_CLIENT_COMMAND_REWRITE.md).1886 unmodified lines188718881889189018911886 unmodified linesRE-976: Forty-eight source command-rewrite cases recover pause-mask1 and mode10/client-mask16 locking, saved-angle restore versus update, and independent server override. Clearing bytes493..495 preserves the low byte492 and command timestamp; buttons clear separately. Other pause bits alone do not trigger this lock. Native later movement execution remains outside this fragment. [Evidence](research/QVM_CLIENT_COMMAND_REWRITE.md).RE-977: Rust matches48 source command rewrites, retaining pause-mask1 selection, mode10/client-mask16 locking, saved-angle direction and independent server masking. The low adjacent command byte survives clearing movement bytes, and command time is not modified by this API. Unit tests cover non-locking pause bits, angle restore/save order and low-byte preservation. [Evidence](research/RUST_CLIENT_COMMAND_REWRITE.md).RE-978: A120-case source contract executes actual150382 through all bounded policy branches: protected entities, disabled config, pause anchoring, signed movement bytes/attack, dead-client deadline extension, exemptions, warnings and timeout. Word arithmetic wraps before signed comparisons. Mode1 queues team-to-s then a message; other modes request a drop. Native effects remain captured; source deadline/warning fields and supplied health are verified. [Evidence](research/QVM_CLIENT_INACTIVITY.md).
1940 unmodified lines1941194219431940 unmodified lines- [x] RE-976 Original command angle preservation and movement-byte masking ([evidence](research/QVM_CLIENT_COMMAND_REWRITE.md)).- [x] RE-977 Rust client command rewriting and byte preservation ([evidence](research/RUST_CLIENT_COMMAND_REWRITE.md)).1940 unmodified lines194119421943194419451940 unmodified lines- [x] RE-976 Original command angle preservation and movement-byte masking ([evidence](research/QVM_CLIENT_COMMAND_REWRITE.md)).- [x] RE-977 Rust client command rewriting and byte preservation ([evidence](research/RUST_CLIENT_COMMAND_REWRITE.md)).- [x] RE-978 Original inactivity policy and ordered warning timeout effects ([evidence](research/QVM_CLIENT_INACTIVITY.md)).
2580 unmodified lines2581258225832580 unmodified lines## 2026-10-28 — RE-977 Rust client command rewriting and byte preservationRust matches48 source command rewrites, retaining pause-mask1 selection, mode10/client-mask16 locking, saved-angle direction and independent server masking. The low adjacent command byte survives clearing movement bytes, and command time is not modified by this API. Unit tests cover non-locking pause bits, angle restore/save order and low-byte preservation. Focused `cargo xtask test-group rust-client-command-rewrite` passes with deterministic report regeneration, relevant regressions and storage/documentation/whitespace checks. Full suite deferred to the tenth-commit boundary. Original assets unchanged; native IO effects remain captured.2580 unmodified lines25812582258325842585258625872580 unmodified lines## 2026-10-28 — RE-977 Rust client command rewriting and byte preservationRust matches48 source command rewrites, retaining pause-mask1 selection, mode10/client-mask16 locking, saved-angle direction and independent server masking. The low adjacent command byte survives clearing movement bytes, and command time is not modified by this API. Unit tests cover non-locking pause bits, angle restore/save order and low-byte preservation. Focused `cargo xtask test-group rust-client-command-rewrite` passes with deterministic report regeneration, relevant regressions and storage/documentation/whitespace checks. Full suite deferred to the tenth-commit boundary. Original assets unchanged; native IO effects remain captured.## 2026-10-28 — RE-978 Original inactivity policy and ordered warning timeout effectsA120-case source contract executes actual150382 through all bounded policy branches: protected entities, disabled config, pause anchoring, signed movement bytes/attack, dead-client deadline extension, exemptions, warnings and timeout. Word arithmetic wraps before signed comparisons. Mode1 queues team-to-s then a message; other modes request a drop. Native effects remain captured; source deadline/warning fields and supplied health are verified. Focused `cargo xtask test-group qvm-client-inactivity` passes with deterministic report regeneration, relevant regressions and storage/documentation/whitespace checks. Full suite deferred to the tenth-commit boundary. Original assets unchanged; native IO effects remain captured.
1977 unmodified lines1978197919801977 unmodified lines- [x] RE-976 Original command angle preservation and movement-byte masking ([evidence](research/QVM_CLIENT_COMMAND_REWRITE.md)).- [x] RE-977 Rust client command rewriting and byte preservation ([evidence](research/RUST_CLIENT_COMMAND_REWRITE.md)).1977 unmodified lines197819791980198119821977 unmodified lines- [x] RE-976 Original command angle preservation and movement-byte masking ([evidence](research/QVM_CLIENT_COMMAND_REWRITE.md)).- [x] RE-977 Rust client command rewriting and byte preservation ([evidence](research/RUST_CLIENT_COMMAND_REWRITE.md)).- [x] RE-978 Original inactivity policy and ordered warning timeout effects ([evidence](research/QVM_CLIENT_INACTIVITY.md)).
12345# Original inactivity policy and ordered warning timeout effects
RE-978. Focused validation: `cargo xtask test-group qvm-client-inactivity`. [Machine report](qvm-client-inactivity.json).
A120-case source contract executes actual150382 through all bounded policy branches: protected entities, disabled config, pause anchoring, signed movement bytes/attack, dead-client deadline extension, exemptions, warnings and timeout. Word arithmetic wraps before signed comparisons. Mode1 queues team-to-s then a message; other modes request a drop. Native effects remain captured; source deadline/warning fields and supplied health are verified.1512 unmodified lines1513151415151512 unmodified lines- [RE-976: Original command angle preservation and movement-byte masking](QVM_CLIENT_COMMAND_REWRITE.md).- [RE-977: Rust client command rewriting and byte preservation](RUST_CLIENT_COMMAND_REWRITE.md).1512 unmodified lines151315141515151615171512 unmodified lines- [RE-976: Original command angle preservation and movement-byte masking](QVM_CLIENT_COMMAND_REWRITE.md).- [RE-977: Rust client command rewriting and byte preservation](RUST_CLIENT_COMMAND_REWRITE.md).- [RE-978: Original inactivity policy and ordered warning timeout effects](QVM_CLIENT_INACTIVITY.md).
123456789101112"""Verified original client-processing source contract."""from pathlib import Pathfrom analyze_qvm import write_jsonfrom qvm_research_support import sourcefrom qvm_client_processing_support import seed,idle,idle_fixtures
def main(): q,raw,h,ins=source();probes=[] for a in idle_fixtures(): m,b=seed(raw,h,a);m,p,b=idle(ins,m,b,a);p['input']=a;probes.append(p) write_json(Path('docs/research/qvm-client-inactivity.json'),dict(source=q['source'],sha256=q['sha256'],probes=probes,limits='120 actual150382 cases cover entity-mask8 bypass, disabled config, pause anchor, movement/attack activity, dead-client deadline extension, exemptions, strict warning/expiry gates and mode-specific team/send/drop effects. Signed word wrap and repeated-warning suppression retained. Native team/send/drop effects captured.'))if __name__=='__main__':main()9 unmodified lines1011129 unmodified linesdef command(a):locked=bool(a['pause']&1) or a['mode']==10 and bool(a['flags']&16);angles=list(a['saved'] if locked else a['angles']);saved=list(a['saved'] if locked else a['angles']);clear=locked or bool(a['block'])return dict(angles=angles,saved=saved,buttons=0 if clear else a['buttons'],move_word=a['move_word']&255 if clear else a['move_word'],command_time=a['command_time'])9 unmodified lines1011121314151617181920212223242526272829303132339 unmodified linesdef command(a):locked=bool(a['pause']&1) or a['mode']==10 and bool(a['flags']&16);angles=list(a['saved'] if locked else a['angles']);saved=list(a['saved'] if locked else a['angles']);clear=locked or bool(a['block'])return dict(angles=angles,saved=saved,buttons=0 if clear else a['buttons'],move_word=a['move_word']&255 if clear else a['move_word'],command_time=a['command_time'])WARN_DROP=b'cp "Ten seconds until inactivity drop!\n"'WARN_SPEC=b'cp "Ten seconds until forced spectator mode!\n"'DROP=b'Dropped due to inactivity'MOVED=b'cp "You were moved to spectator due to inactivity!\n"'def idle(a):deadline=a['deadline'];warned=a['warned'];accepted=True;events=[];tick=signed(a['tick']);limit=(a['tick']+a['idle_seconds']*1000)&0xffffffffif a['entity_flags']&8:passelif a['idle_seconds']==0:deadline=(a['tick']+60000)&0xffffffff;warned=0elif a['pause']:limit=(a['pause_anchor']+a['idle_seconds']*1000)&0xffffffffif signed(deadline)<signed(limit):deadline=limitelif any(a['moves']) or a['buttons']&1:if signed(deadline)<signed(limit):deadline=limitwarned=0elif signed(a['health'])<=0:deadline=(deadline+a['msec'])&0xffffffffelif a['exempt']:passelif tick>signed(deadline):accepted=False;events=[dict(op='team',slot=2,text=b's'.hex(),force=0),dict(op='send',slot=2,text=MOVED.hex())] if a['mode']==1 else [dict(op='drop',slot=2,text=DROP.hex())]elif tick>signed(deadline-10000) and not warned:warned=1;events=[dict(op='send',slot=2,text=(WARN_SPEC if a['mode']==1 else WARN_DROP).hex())]return dict(accepted=accepted,events=events,deadline=deadline&0xffffffff,warned=warned,health=a['health']&0xffffffff)
48 unmodified lines49505148 unmodified linesdef command(ins,m,b,a):command_seed(m,a);m,e,b=execute(ins,m,b,154256,154389)return m,dict(**command_view(m),execution={k:e[k] for k in ['stop','trace_length','trace_sha256']}),b48 unmodified lines49505152535455565758596061626364656667686948 unmodified linesdef command(ins,m,b,a):command_seed(m,a);m,e,b=execute(ins,m,b,154256,154389)return m,dict(**command_view(m),execution={k:e[k] for k in ['stop','trace_length','trace_sha256']}),bdef idle_fixtures():profiles=[('protected',dict(entity_flags=8,deadline=0,warned=1)),('disabled',dict(idle_seconds=0,deadline=0,warned=1)),('paused',dict(pause=1)),('paused-keep',dict(pause=1,deadline=90000,warned=1)),('forward',dict(moves=[1,0,0],deadline=0,warned=1)),('right',dict(moves=[0,128,0],deadline=0,warned=1)),('up',dict(moves=[0,0,255],deadline=0,warned=1)),('attack',dict(buttons=1,deadline=0,warned=1)),('dead',dict(health=0,deadline=9000)),('exempt',dict(exempt=1,deadline=0)),('expired',dict(deadline=9999)),('warning',dict(deadline=19999)),('equal',dict(deadline=10000)),('already-warned',dict(deadline=19999,warned=1)),('warning-boundary',dict(deadline=20000)),('other-button',dict(buttons=2,deadline=9999)),('negative-idle',dict(idle_seconds=0xffffffff,moves=[1,0,0],deadline=0,warned=1)),('wrapped-idle',dict(idle_seconds=0x7fffffff,moves=[1,0,0],deadline=0,warned=1)),('dead-wrap',dict(health=0,deadline=0xffffffff)),('other-pause-bit',dict(pause=2,deadline=0,warned=1))]defaults=dict(entity_flags=0,idle_seconds=60,pause=0,pause_anchor=3000,tick=10000,moves=[0,0,0],buttons=0,health=1,exempt=0,deadline=20000,warned=0)return [dict(defaults,**changes,name=name,mode=mode,msec=msec) for name,changes in profiles for mode in [0,1] for msec in [0,100,0xffffffff]]def idle_seed(m,a):m.update({CLIENT+140:2,34091792+880*2:a['entity_flags'],34085460:a['idle_seconds'],35000452:a['pause'],35000456:a['pause_anchor'],34992532:a['tick'],CLIENT+3140:a['deadline'],CLIENT+4144:a['warned'],CLIENT+208:a['health'],CLIENT+500:a['exempt'],34063260:a['mode'],CLIENT+488:a['buttons'],CLIENT+492:42+sum(v<<(8*(j+1)) for j,v in enumerate(a['moves']))})def idle_run(ins,m,b,msec):events=[]def team(i,m,a,bs):events.append(dict(op='team',slot=(a[8]-34091368)//880,text=cstring(m,bs,a[12]).hex(),force=a[16]));return m,0,{'team_callback183102_captured':True}def send(i,m,a,bs):events.append(dict(op='send',slot=a[8],text=cstring(m,bs,a[12]).hex()));return m,0,{'network_send_captured':True}def drop(i,m,a,bs):events.append(dict(op='drop',slot=a[8],text=cstring(m,bs,a[12]).hex()));return m,0,{'native_drop_captured':True}m,v,p,b=run(ins,m,150382,150691,28,{8:CLIENT,12:msec},b,{183102:team,-18:send,-17:drop},base=ROOT+0x20000)p.update(accepted=v==1,events=events,deadline=m[CLIENT+3140]&0xffffffff,warned=m[CLIENT+4144]&0xffffffff,health=m[CLIENT+208]&0xffffffff);return m,p,bdef idle(ins,m,b,a):idle_seed(m,a);return idle_run(ins,m,b,a['msec'])
123456789101112import json,unittestfrom pathlib import Pathfrom qvm_client_processing_oracle import idleclass OriginalTests(unittest.TestCase): def test_original_contract(self): rows=json.loads(Path('docs/research/qvm-client-inactivity.json').read_text())['probes'];self.assertEqual(len(rows),120) for p in rows: for k,v in idle(p['input']).items():self.assertEqual(p[k],v) def test_fixture_identity_and_trace(self): r=json.loads(Path('docs/research/qvm-client-inactivity.json').read_text());self.assertEqual(len(r['sha256']),64) self.assertTrue(all(p['execution']['trace_length']>0 for p in r['probes']))if __name__=='__main__':unittest.main()3591 unmodified lines3592359335943591 unmodified linesedge crates/urt-gameplay/src/bin/urt-client-timer.rs scripts/analyze_rust_client_command_rewrite.pyedge crates/urt-gameplay/src/client_processing.rs scripts/analyze_rust_client_command_rewrite.pyedge crates/urt-gameplay/src/bin/urt-client-processing.rs scripts/analyze_rust_client_command_rewrite.py3591 unmodified lines35923593359435953596359735983591 unmodified linesedge crates/urt-gameplay/src/bin/urt-client-timer.rs scripts/analyze_rust_client_command_rewrite.pyedge crates/urt-gameplay/src/client_processing.rs scripts/analyze_rust_client_command_rewrite.pyedge crates/urt-gameplay/src/bin/urt-client-processing.rs scripts/analyze_rust_client_command_rewrite.pyreport scripts/analyze_qvm_client_inactivity.py docs/research/qvm-client-inactivity.jsonedge docs/research/qvm-client-inactivity.json scripts/test_qvm_client_inactivity.pygroup qvm-client-inactivity scripts/analyze_qvm_client_inactivity.pyedge scripts/analyze_qvm_client_inactivity.py scripts/analyze_qvm_resumer_audit.py
docs/FINDINGS.md+2
docs/PROVISIONAL_TODO.md+2
docs/RESEARCH_LEDGER.md+4
docs/REVERSE_ENGINEERING_TODO.md+2
docs/research/QVM_CLIENT_INACTIVITY.mdAdded+5
docs/research/README.md+2
docs/research/qvm-client-inactivity.jsonAdded
scripts/analyze_qvm_client_inactivity.pyAdded+12
scripts/qvm_client_processing_oracle.py+21
scripts/qvm_client_processing_support.py+18
scripts/test_qvm_client_inactivity.pyAdded+12
xtask/checks.tsv+4